is there a way to Grep for a specific field in a ; separated file.  | |
December 2nd, 2008, 04:11 PM
|
#1 (permalink)
| | MR Meek and Mild
Join Date: Mar 2002 Location: almost Virginia
Posts: 5,115
| is there a way to Grep for a specific field in a ; separated file.
I don't care if it is specifically a grep.
Basically I need to know records which contain a 5 in the 39th field. i want to then pull the entire record for those records containing 5 in the field.
Awk
Grep... I dont really care what magic I just need to do this. |
| |
December 2nd, 2008, 04:30 PM
|
#2 (permalink)
| | Ride 'em Cowboy
Join Date: Oct 2001 Location: Dallas, TX
Posts: 8,774
|
For clueless people like me: Quote: | grep is a command line text search utility originally written for Unix. The name is taken from the first letters in global / regular expression / print, a series of instructions for the ed text editor. [1] The grep command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output.
|
__________________ Have you hugged your kid today?? |
| |
December 2nd, 2008, 04:35 PM
|
#3 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,552
|
Regex and perl would do, can you run a script?
__________________
Signatures blow hard
If your signature contains an ad of any kind, congratulations, you're on my ignore list.
|
| |
December 2nd, 2008, 08:30 PM
|
#4 (permalink)
| | Caveat Emptor
Join Date: Mar 2005 Location: Out of my mind
Posts: 3,241
|
And if you're really hard up for this, I can put togehter a quicky exe application...as long as you're not in a HUGE hurry!  |
| |
December 3rd, 2008, 10:20 AM
|
#5 (permalink)
| | MR Meek and Mild
Join Date: Mar 2002 Location: almost Virginia
Posts: 5,115
| Quote:
Originally Posted by Rootstonian And if you're really hard up for this, I can put togehter a quicky exe application...as long as you're not in a HUGE hurry!  | Actually that is really nice of your and i appreciate it . butttttt they project goes beyond just doing a one off specific exe. |
| |
December 3rd, 2008, 04:55 PM
|
#6 (permalink)
| | Caveat Emptor
Join Date: Mar 2005 Location: Out of my mind
Posts: 3,241
|
Ok, from DOS box, try this
C:\> sort input.tx /+39 output.txt
LOL...should be fun ROFL |
| |
December 3rd, 2008, 06:25 PM
|
#7 (permalink)
| | MR Meek and Mild
Join Date: Mar 2002 Location: almost Virginia
Posts: 5,115
|
gunzip -c /data/prospect/sent/081128??.DATA.gz|nawk -F";" '{if ($39 == 5) print $3,$4,$6,$7,$10,$11,$14,$15,$22,$25,$26,$27,$31,$3 8,$39,$41,$70}'
The above command looks at file 081128??.DATA.gz in field 39 for a value of 5 and then prints select fields between 3 and 70 |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |