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: 1418
Discussions: 195,859, Posts: 2,328,016, Members: 241,383
Old December 2nd, 2008, 03:11 PM   Digg it!   #1 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 4,827
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, 03:30 PM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Location: Dallas, TX
Posts: 7,962
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.

Steve R Jones is offline   Reply With Quote
Old December 2nd, 2008, 03: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, 07:30 PM     #4 (permalink)
Caveat Emptor
 
Rootstonian's Avatar
 
Join Date: Mar 2005
Location: Out of my mind
Posts: 3,125
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, 09:20 AM     #5 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 4,827
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, 03:55 PM     #6 (permalink)
Caveat Emptor
 
Rootstonian's Avatar
 
Join Date: Mar 2005
Location: Out of my mind
Posts: 3,125
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, 05:25 PM     #7 (permalink)
MR Meek and Mild
 
Epidemic's Avatar
 
Join Date: Mar 2002
Location: almost Virginia
Posts: 4,827
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 01:50 PM
Detecting hotlinking/referrals to a specific file? eccod Webmastering and Programming 11 December 12th, 2004 03:44 PM
Open file name entered into text field millerlite86 Webmastering and Programming 0 May 18th, 2004 08:48 PM
how can i make another computer recognize a specific file extension? zskillz Webmastering and Programming 9 December 15th, 2002 03:14 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (1447)
Palin Resigning as Governor (45)
Budget PC Build, first time - Need .. (14)
[F@H SPAM 28 JUN 09] Today's the da.. (138)
Looking for Some good PC games. (9)
Worth upgrading GFX card? (38)
build advice (20)
You guys might like this one (22)
Crap, my graphics have gone to hell (17)
Is this a decent gaming system??? (25)
4gb RAM (7)
Gigabyte 770 vs 790GX (cant decide) (8)
Need Technical Expierience (78)
need a laptop (5)
Recent Discussions
Broken Sound Card? Maybe. (4)
Worth upgrading GFX card? (38)
Desktop Computer on Laptop Screen (2)
Need Technical Expierience (78)
Gigabyte 770 vs 790GX (cant decide) (8)
build advice (20)
Windows 7 Beta won't install (6)
[F@H SPAM 28 JUN 09] Today's the day... (138)
Gaming Laptop (2)
[Seriously need help] External hard d.. (0)
Not enough RAM... (1)
wifes laptop (1)
Apple no longer using nVidia? (0)
internet connection is breaking (10)
please help (1)
What salary can I expect once I gradu.. (0)
Windows Product Key (5)
Looking for Some good PC games. (9)
Weird Battlefield 2 errors (3)
ps3 connection- no video signal (1)
firefox 3.5 is slow to start (10)
Apple iPhone 3G S 32GB Unlocked (0)
Explorer page shuts down...HELP.. (0)
video card (2)
need a laptop (5)


All times are GMT -4. The time now is 09:03 PM.
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