remove certain lines from file based on start of line except beginning and ending
Hi, I have multiple files which all have multiple entries like below..
Quote:
Any help will be greatly appreciated. Thanks |
Maybe using something like:
Code:
sed '1!{/^00/d};$!{/^80/d}' file |
Thanks for your reply.
When i run the above command this is the result i get: Quote:
|
Works for me, maybe its a version thing
Code:
sed --version |
Indeed, googlin' around it seems an error from UNIX sed. I don't know how to modify it to let it work in not-GNU sed, but until someone more experienced steps in, here is an awk solution:
Code:
awk '/^00/ && !_[00]++; /^80/{rec = $0}; !/^00/ && !/^80/; END { print rec }' file |
Thanks for your help colucix
I eventually got it working with the help of a colleague. the script we used was: Quote:
|
All times are GMT -5. The time now is 05:14 PM. |