The code below copies the names of the .xml into a text file.

 for a in $(cd any/directory; ls *xml) do echo "awk 'NR>1 {print $0}' < ../$a > tmp_file" >> data.txt done 

But when I try to insert this line into the awk 'NR>1 {print $0}' text file, there are problems due to $0 . As a result, because of this, the output is:

 awk 'NR>1 {print bash}' < ../любой_файл.xml > tmp_file 

How can I solve this problem?

  • I imagine what will happen when you feel the joy of python (the shell is a rather complicated programming language, considering your previous question, it seems to me that you chose not the easiest solution). - 0andriy

1 answer 1

"Escape" the $ character by adding before it a "backslash" \ :

 \$ 
  • Thanks It works! - user2899758