using sed
hi,
the problm is : cat myfile: ABCD/xyz.html ABCD/prs.html ABCD/qty.html ----- --------- ----- upto 1000+ lines I want to take only the fields xyz, prs, qty etc and save it in another file. How to do it using sed? sed -n '/\//,/html/p' pathname ______ is not working..... pls help |
I'm not a sed expert either, but something like this
Code:
sed 's/[ABCD/]*//;s/[.html]*$//' file > newfile Take a look at this guide for more. |
Your sed regexp won't work because it prints lines "inclusive " of the strings.
Probably easier to substitute the said strings with "BLANK" and then pipe the output to a new file. This works and I'm sure someone with much more experience in Sed can come out with a shorter one liner. sed -e 's/ABCD\///g' -e 's/\.html//g' file > stripped_file Which is basically what bathory's sed script does. Hope this helps. Uncle |
All times are GMT -5. The time now is 11:16 PM. |