I'm using ls & awk to generate a (small) numbered list of files ending in .art. Rather than having the user enter the long filename, I want to pick a number and pass the respective filename on to the next command. Here's what I have so far:
ls -lh *.art | awk '{ print NR, ":\t", $5, "\t",$6, $7 $8, $9 }'
The output looks like:
1 : 1.4G Mar 3008:46 2005_035155903000000c004.art
2 : 402M Mar 3008:44 2005_036234503000000c004.art
3 : 88M Mar 3008:44 2005_037133003000000x004.art
Enter .art file number (1, 2, 3...):
I'm using: "set INPUT = $<" to capture the users choice (1, 2, or 3...) but how can I use awk to convert the users choice to the respective filename to pass to the next command?
Where the next command would be something like:
read_art_file $INPUT
Thanks,
Frank
ls -lh *.art | awk '{ print NR, ":\t", $5, "\t",$6, $7 $8, $9 }'
The output looks like:
1 : 1.4G Mar 3008:46 2005_035155903000000c004.art
2 : 402M Mar 3008:44 2005_036234503000000c004.art
3 : 88M Mar 3008:44 2005_037133003000000x004.art
Enter .art file number (1, 2, 3...):
I'm using: "set INPUT = $<" to capture the users choice (1, 2, or 3...) but how can I use awk to convert the users choice to the respective filename to pass to the next command?
Where the next command would be something like:
read_art_file $INPUT
Thanks,
Frank