![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| remove lines in text starting with . (period) | Movomito | UNIX for Dummies Questions & Answers | 11 | 04-24-2008 07:19 AM |
| How to delete first 5 lines and last five lines in all text files | ragavendran31 | Shell Programming and Scripting | 10 | 02-21-2008 04:58 AM |
| How to delete initial N bytes from the starting of the file using sed? | jockey007 | Shell Programming and Scripting | 3 | 11-19-2007 05:26 PM |
| How to delete N bytes from the starting of the file from a C function??? | jockey007 | High Level Programming | 2 | 11-15-2007 07:25 PM |
| delete blank lines or lines with spaces only | vascobrito | UNIX for Dummies Questions & Answers | 3 | 01-13-2004 04:36 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi There!
My final task for today is to delete lines starting with certain numbers for e.g., my text block is Quote:
I know i can use multiple sed commands like sed '/^11,/d' <filename> sed '/^17,/d' <filename> sed '/^21,/d' <filename> but is there any way of doing this in one sed command? for e.g. sed '/^[11|17|21]/d' <filename> Thanks again! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
sed '/^1[17],/d;/^21,/d' filename |
|
#3
|
||||
|
||||
|
Or with grep:
Code:
egrep -v '^(1[17]|21),' filename |
||||
| Google The UNIX and Linux Forums |