Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-06-2013, 12:45 PM   #16
Registered: Aug 2012
Posts: 205

Original Poster
Rep: Reputation: Disabled

Originally Posted by David the H. View Post
I think then that what you really want is something like this:



	awk -F ',' '$10 == 42 { count++ } END{ print FILENAME , count }' "$1"

cd "$topdir"

while IFS='' read -r -d '' fname ; do

	awksearch "$fname"

done < <( find ./ -type f -name "file*.txt" -print0 ) | sort -k2nr >"$outfile"

exit 0
I set it up so that you could override the default startdir and output file on the command line. It's only been slightly tested though, since I don't have the data you do.
Hi guys, I've been using David's scripty and it's works really great for what its supposed to do. Now I'd like to modify it a little....

I still need it to search down a bunch of directories, looking in file*.txt to find the number 42 in column 10, but for this next job when it finds 42 in column 10, I need it to print out what's in column 9

I guess where I'm having trouble in changing the script myself is understanding how the print statement is being used in David's script. I understand how to write a "basic" print statement. I think it's just that I don't understand how it's being used. Whenever I change things in it I get either a syntax error, path must exceed expression, or invalid predicate

thanks for whatever help you can, Tabby


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Silencing recursive make Shannon Barber Linux - General 2 01-21-2012 04:01 PM
make: *** [install-recursive] Error 1 phantom_cyph Linux - Software 1 02-19-2008 11:06 PM
make :recursive error appasamy Linux - Software 1 01-03-2005 01:01 AM
Recursive make SeanatIL Linux - Software 2 08-04-2004 04:47 PM
Stopping recursive make's on error Meatwad Programming 0 04-28-2004 06:31 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration