abraxas334
October 13th, 2008, 11:52 AM
Hello,
I would like to get data out of say 100 files names like test1.dat test2.dat etc and put them into a single file.
I know i can do it with one using awk in the following way, when i say want to get the 2nd column of the file
awk 'BEGIN{FS="\t"; OFS="\t"} {print $2}'test1.dat >output.dat
how can i use a wildcard so all 100 files will be done automatically, so i won't have to change the input file name for every single one of them.
I tried
awk 'BEGIN{FS="\t"; OFS="\t"} {print $2}'test*.dat >output.dat
but that didn't work.
What kind of wildcards has awk got?
I would like to get data out of say 100 files names like test1.dat test2.dat etc and put them into a single file.
I know i can do it with one using awk in the following way, when i say want to get the 2nd column of the file
awk 'BEGIN{FS="\t"; OFS="\t"} {print $2}'test1.dat >output.dat
how can i use a wildcard so all 100 files will be done automatically, so i won't have to change the input file name for every single one of them.
I tried
awk 'BEGIN{FS="\t"; OFS="\t"} {print $2}'test*.dat >output.dat
but that didn't work.
What kind of wildcards has awk got?