home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > General Tech Discussion
Ask a Tech Support Question (free)!

is there a way to Grep for a specific field in a ; separated file.

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1183
Discussions: 200,903, Posts: 2,378,884, Members: 246,272
Old December 2nd, 2008, 04:11 PM   Digg it!   #1 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 5,115
Blog Entries: 2
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.
Epidemic is offline   Reply With Quote
Old 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??
Steve R Jones is offline   Reply With Quote
Old December 2nd, 2008, 04:35 PM     #3 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,552
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
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.
jkrohn is offline   Reply With Quote
Old December 2nd, 2008, 08:30 PM     #4 (permalink)
Caveat Emptor
 
Rootstonian's Avatar
 
Join Date: Mar 2005
Location: Out of my mind
Posts: 3,241
Send a message via AIM to 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!
Rootstonian is offline   Reply With Quote
Old December 3rd, 2008, 10:20 AM     #5 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 5,115
Blog Entries: 2
Quote:
Originally Posted by Rootstonian View Post
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.
Epidemic is offline   Reply With Quote
Old December 3rd, 2008, 04:55 PM     #6 (permalink)
Caveat Emptor
 
Rootstonian's Avatar
 
Join Date: Mar 2005
Location: Out of my mind
Posts: 3,241
Send a message via AIM to Rootstonian
Ok, from DOS box, try this

C:\> sort input.tx /+39 output.txt

LOL...should be fun ROFL
Rootstonian is offline   Reply With Quote
Old December 3rd, 2008, 06:25 PM     #7 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 5,115
Blog Entries: 2
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
Epidemic is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Locating a specific sound file Blitzkreig75 Applications and Operating Systems 5 January 2nd, 2006 02:50 PM
Detecting hotlinking/referrals to a specific file? eccod Webmastering and Programming 11 December 12th, 2004 04:44 PM
Open file name entered into text field millerlite86 Webmastering and Programming 0 May 18th, 2004 09:48 PM
how can i make another computer recognize a specific file extension? zskillz Webmastering and Programming 9 December 15th, 2002 04:14 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2799)
Is the PSU I received dead? (10)
Install XP pro and a Vista laptop ?.. (8)
California Passes Anti-Flat-HDTV Le.. (38)
A good PSU? (10)
Fox uses old news clips to inflate .. (33)
HIS HD5770 graphic card question (14)
Foreign voltage (5)
New Computer wont recognize XP disc (7)
Dept. of HS: NSA 'Helped' Develop V.. (12)
Print spooler problem (5)
EVGA 9800 gtx help with finding a g.. (6)
Ideal cheap graph card for PC-Gamin.. (14)
Mysterious Boot manager (9)
Recent Discussions
Ideal cheap graph card for PC-Gaming? (14)
HIS HD5770 graphic card question (14)
Install XP pro and a Vista laptop ?? (8)
Need hard disk drivers (3)
Cloning old drive to new drive (6)
Asus P4G8X Mobo (0)
Amptron monitor G17FP-Black (0)
windows vista security holes (0)
EVGA 9800 gtx help with finding a goo.. (6)
A good PSU? (10)
Is the PSU I received dead? (10)
HP Pavillion Laptop ze4220 won't turn.. (7)
Dept. of HS: NSA 'Helped' Develop Vis.. (12)
Foreign voltage (5)
Convert 5 pin Keyboard to USB (11)
Print spooler problem (5)
hybernate option (2)
Steam ID's, Gamertags etc... (1)
New Computer wont recognize XP disc (7)
World's largest Monopoly Game using G.. (328)
Modern Warfare 2: Who Bought It? (60)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (28)
blender help (2)
Hard drive freezes boot (1)
Mysterious Boot manager (9)


All times are GMT -4. The time now is 03:44 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28