Awk/examples

Search for $var in * files
This script get a value from listOfValues.txt and searches through all .dat files in the /data directory it pulls out the data in Colom 4 and apends it to one line of output we should really use Vars instead of filensmes and all that nice stuff but hay =)

$4 means test colom 4

~ = partal match

/'$x'/ = /y/ says patern match, '$x' i used quotes becouse im using a varable from outside of awk.

{found=found", "$1} apends a, and data from colom 1 to the varible found

END = exacutes this code after the last file has been closed

{ print "'$x'" found } prints out $x (the value we were searching for) again i quoted this value as before and the found data

[code] listOfValues.txt

big cup sox [/code]

[code] data/2005.dat size 0 t itsbig thing 1 e teacup magic 2 g holysox [/code]

[code] data/2006.dat notsmall 0 t itsbig FnoRd 1 e teabag fNORd 2 g longsox [/code]

[code] listOfMatchedData.txt big, size, notsmall cup, thing sox, magic, longsox [/code]