I have a file in which the lines are written through the transfer ( \n\r ). I do:

 > $(< data.csv) 

But I get on the first line:

bash: path_to_file / file.ext: Argument list too long

Similar commands do not give results. The problem remains:

 `cat data.csv` 

And so, too:

 $("cat data.csv") 

How to fix. Tell me.

  • What do you want to do? Why do you need the contents of the csv-file in the team? - VladD
  • @VladD I want to take the names of the files that are data.csv in data.csv and write them into a variable. In particular, I will give this variable then to the script. - hedgehogues
  • @VladD here I found some description of the problem. But it says everywhere that the size of the string is too big. But, sorry, I have an argument of no more than 200 characters. What kind of joke is this? - hedgehogues
  • Hmm, why so? You can easily exhaust the size of the buffer allocated for transferring the command line. Why not pass the desired list as an input stream? - VladD
  • one
    For example, through cat? cat file1.csv file2.csv file3.csv | script cat file1.csv file2.csv file3.csv | script . - VladD

1 answer 1

  1. you need to save the content to a variable, and you are trying to "execute" this content. i.e., instead of

     $(cat файл) 

    you need something like

     переменная=$(cat файл) 

    or at least

     echo $(cat файл) 
  2. to remove the \r characters (hexadecimal 0d ), you can use, for example, the tr program:

     переменная=$(cat файл | tr -d '\r')