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: 2145
Discussions: 200,512, Posts: 2,374,432, Members: 245,837
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,101
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,702
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 online now   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,232
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,101
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,232
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,101
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? (1639)
windows 7 retail and rtm (5)
FT HOOD attack: 7 killed 12 injured (67)
HELP!!! What do you think of this s.. (20)
Review My Build (6)
Assosiations (21500)
Looking for a graphic card that wil.. (30)
My 1st pc build (40)
PC Modern Warfare 2: it's much wors.. (12)
Aero in Vista (7)
core i7 extreme 975, nvidia 9400gt (9)
How to Ship a PC (16)
Building my first computer (13)
[F@H SPAM 11/1/09]New month . . . n.. (33)
Recent Discussions
My Pc wont start after i interupted d.. (0)
HELP!!! What do you think of this sys.. (20)
windows 7 retail and rtm (5)
New processor technical problem (0)
boot from CD-ROM in chipset via P4M80.. (2)
Powe Director v8 (0)
Windows Experience Index is screwed u.. (3)
Review My Build (6)
FAT32 to NTFS file system in Win2kpro (4)
Internet very slow since updating AVG.. (8)
Motherboards and my curse... (25)
New Processor, Monitor will not turn .. (2)
2009 Build (4)
My 1st pc build (40)
Freezing During Music/Movies (1)
ext. sound card laptop to stereo syst.. (2)
Remote Desktop via SSH and error mess.. (2)
Help and Support disappeared from my .. (0)
[F@H SPAM 11/1/09]New month . . . new.. (33)
Basic applications needed for "r.. (1)
core i7 extreme 975, nvidia 9400gt (9)
hard drive problem (2)
Win7 TrustedInstaller Permissions (2)
Speed up Win 7 boot time a bit (1)
Hard Drive test program (2)


All times are GMT -4. The time now is 10:29 AM.
TechIMO Copyright 2008 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