![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to read record by record from a file in unix | raoscb | UNIX for Dummies Questions & Answers | 1 | 05-16-2008 06:30 AM |
| Remove First and Last Record from a file | ravikuc | UNIX for Dummies Questions & Answers | 1 | 10-11-2007 03:35 AM |
| splitting a record and adding a record to a file | rsolap | Shell Programming and Scripting | 1 | 08-13-2007 01:58 PM |
| command to remove last record on file | mheinen | UNIX for Dummies Questions & Answers | 4 | 01-09-2007 04:39 PM |
| remove duplicated xml record in a file under unix | happyv | Shell Programming and Scripting | 8 | 09-20-2006 01:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Quote:
![]() Code:
$ cat file
NMT000010000100001ENVL,CSP,28#,9X12,KFT,1C 00001
NA20000105500000003081547100100008000000000024.19 000000000000001DZ 000000000024.19 000000000000000 00002
NPD TOP63120
TOP63120
NP2
00000000000000 00000000000000 000
00000000000000 00000000000001 00000000000000 00000000000000
NMT000010000800001PAD,LGL RL,PRISM,LTR,BE
$ grep -v '^NA2\|^NPD' file > new_file
$ cat new_file
NMT000010000100001ENVL,CSP,28#,9X12,KFT,1C 00001
TOP63120
NP2
00000000000000 00000000000000 000
00000000000000 00000000000001 00000000000000 00000000000000
NMT000010000800001PAD,LGL RL,PRISM,LTR,BE
$ wc -l file
8 file
$ wc -l new_file
6 new_file
Code:
$ sed '/^NA2/d;/^NPD/d;' file > new_file2
$ wc -l new_file2
6 new_file2
|
|
||||
|
Dan, dont know why the 'grep -v' not working but your 'sed' option is working [
|
| Sponsored Links | ||
|
|