MarcSerra
MarcSerra

Reputation: 34

bash variable string with quotes and double quotes

I need to store a string in a variable on bash.

Here the string...

7;310000000007;1390;30000001390;119;130000000119;;;;;939738;30;ST;DESCRIPTION TEXT TEXT " TEXT ' TEXT text;20130318;   1.40;;   0.00;1459

Note that have both quotes and double quotes. It's possible to store it on a variable in BASH?

An important cosideration: I can't add \" or \', because is a text file with 150.000 line like the string.

Thank's!

Upvotes: 0

Views: 527

Answers (1)

darxsys
darxsys

Reputation: 1570

Not really sure, but I think you can try with read, for example:

while read var
do
    echo $var
done < file.txt

Reading lines like that from a file should be okay with read.

Upvotes: 2

Related Questions