![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Linux and Unix Error ! Redhat,suse,centos,mandrake,Free BSD,Sun |
![]() |
|
grep and write to file from Shell script
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 18,695
Join Date: Jan 2006
Rep Power: 10
IM:
|
Type: Shell Script I have a CSV file in the following format. '112'|1|'1480196'|15||'A' '112'|1|'1481645'|15||'A' '145'|1|'1492362'|15||'A' '145'|1|'15103891'|15||'A' '157'|1|'1536122'|15||'A' '157'|1|'1537942'|15||'A' '168'|1|'1587454'|15||'A' '168'|1|'1596169'|15||'A' From the above file, I would like to grep the rows with first column '145' and write them to a different file, can someone give me a script to do that. |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Administrator
Posts: 18,695
Join Date: Jan 2006
Rep Power: 10
IM:
|
$( wc -l $2.$$ ) should become $( cat $2.$$ | wc -l ) an no filename should be printed. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|