I am trying to make script to rename files in the directory, they are mess, because of spaces between words (e.g. Computer Networking Explained Cisco CCNA 200-301.mp4 etc). First I need to sort them by time and then print them with the help of gawk
. But I need to pass variable with the number of each line to gawk
.
var=1;
while [ $var -le $(wc file.txt | gawk '{print$1}') ]; do
echo $var;
gawk 'BEGIN{FS="\n";RS=""}{print $($var)}' file.txt;
var=$[ $var + 1 ];
done
. But it prints all lines of file, not single line.