![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exclude a line | big123456 | Shell Programming and Scripting | 3 | 04-24-2008 09:31 AM |
| deleting multiple records from a huge file at one time | dsravan | Shell Programming and Scripting | 5 | 02-06-2008 08:17 AM |
| Count No of Records in File without counting Header and Trailer Records | guiguy | Shell Programming and Scripting | 2 | 06-07-2007 09:15 AM |
| Exclude & Zip | dreams5617 | Shell Programming and Scripting | 1 | 02-11-2007 05:01 PM |
| tar: how to exclude subdirectories? | kymberm | Filesystems, Disks and Memory | 7 | 10-15-2002 12:53 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
exclude multiple records
Hi
I need to exclude multiple records in file .Using grep -v ,can exclude that record Ex: If want to exclude 0012777201,0012777202 use grep two times .Is there any command to achive this through single command ?( cann't use grep multiple times if need to exclude multiple records in husge file) grep -v 0012777201 a.txt >a1.txt grep -v 0012777202 a1.txt >a2.txt a.txt ==== 20080331|2505|0012777201|1|U|U|U| 20080331|2505|0012777202|1|U|U|U| 20080331|2505|0012777204|1|U|U|U| 20080331|2505|0012777205|1|U|U|U| 20080331|2505|0012777206|1|U|U|U| Thanks, MR |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hi,
You can overcome it by using doubt quotes, as follows. grep -v "00127772*" a.txt >a1.txt Thanks Aketi |
|
#3
|
|||
|
|||
|
try egrep.
it can eat regular expressions for your case: egrep -v "001277720[12]" a.txt or egrep -v "00127772011|00127772012" a.txt |
|
#4
|
|||
|
|||
|
Cut a string
Hi All,
i have a requirement to exclude .csv from a file I used cut -d ".csv",but its not working. Can you please help |
|
#5
|
|||
|
|||
|
Hi
Its working,Thanks for your reply Thanks MR |
|
#6
|
|||
|
|||
|
but the most correct way is not using grep here. Because it potentially can match value from other fields.
Here is an awk solution: awk '$3!=0012777201 && $3!=0012777202; BEGIN {FS="|"}' 1.txt |
|||
| Google The UNIX and Linux Forums |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|