I need to add $author \t $title \t to the beginning of every line in a tab-seperated CSV file. This is an example of what the file looks like originally:
0001 This is a line. 0002 This is another line. 0003 This is yet another line. After editing, and assuming $author is set to "Lewis Carroll" and $title set to "Through the Looking Glass", the output would look just like this:
Lewis Caroll Through the Looking Glass 0001 This is a line. Lewis Caroll Through the Looking Glass 0002 This is another line. Lewis Caroll Through the Looking Glass 0003 This is yet another line. I tried the following attempts with awk, but it does not work as expected, and $author and $title do not appear to be added anywhere in the file:
awk -F'\t' '{ print "$author\t$title\t" $0 }' file.txt awk -F"\t" '{ print $author \t $title \t $0 }' file.txt How can I add some data, containing BASH variables, as cells, to the beginning of all of the lines in a tab-seperated CSV file?