On 11Jun2007 11:24, Michael Sullivan <[EMAIL PROTECTED]> 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? Gah! No. | 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 | home/michael/.evolution/cache/tmp/evolution-tmp-g9stix/voice-message.wav [...] | 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 <[EMAIL PROTECTED]> DoD#743 http://www.cskk.ezoshosting.com/cs/ The most incomprehensible thing about the world is that it is at all comprehensible. - Albert Einstein To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be removed. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/LINUX_Newbies/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/LINUX_Newbies/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
