Re: Deleting characters at the beginning of a line
On 11Jun2007 11:24, Michael Sullivan <michael@...> wrote:
| On Mon, 2007-06-11 at 09:45 -0500, Robert C Wittig wrote:
| > Michael Sullivan wrote:
| > > Is there an easy way to delete a set number characters from the
| > > beginning of a line,
sed 's/.....//' <file1 >file2
removes 5 characters.
| or do I just need to write a perl script to do it?
| My actual application for this is thus: I have a file of information in
| this format. It is diff output:
| < -r--r--r-- michael/users 1204048 2007-05-25 13:34
| What I need to do is extract everything after the string 'home'. Only
| that. I tried using `cat diff.txt | cut -c 51-`, but it seems that the
| filename in the listing does not always start in column 51. Is there a
| way I can extract only the filename from the listing? I tried man tr,
| but I didn't understand it...
sed 's:.*home/::' <file1 >file2
Note the different pattern delimiters; because I'm aiming for "home/",
using / as the delimiter would be inconvenient.
Cameron Simpson <cs@...> DoD#743
The most incomprehensible thing about the world is that it is at all comprehensible.
- Albert Einstein