Differences

This shows you the differences between two versions of the page.

Link to this comparison view

bashparsing [2018/01/24 10:56] (current)
yassine chaouche created
Line 1: Line 1:
 +\\
 +[[:​index|Home]] > [[:​computers|computers]] > [[:​linux|linux]] > [[:​bash|bash]] > [[bashparsing]] | [[:​about|About]]\\
 +[[index|Home]] > [[Computers | Computers]] > [[programming|programming]] > [[scripting]] > [[:​bash|bash]] > [[bashparsing]] | [[About]]
 +
 +Use ''​IFS=$'​\t ,'''​ when reading.
 +
 +The $ before the string is mandatory to correctly interprete \t as a tab, and not as two characters '​\'​ and '​t'​.
 +
 +
 +<​code>​
 +# cat /tmp/irc
 +radioculture ​   , radio-culture
 +prodculture ​    , prod-culture
 +infoculture ​    , info-culture
 +progculture ​    , prog-culture
 +seculture ​      , sec-culture
 +dirculture ​     , dir-culture
 +# while IFS=$'​\t ,' read -r first second; do echo "​-$first-"​ "​-$second-";​ done < /tmp/irc
 +-radioculture- -radio-culture-
 +-prodculture- -prod-culture-
 +-infoculture- -info-culture-
 +-progculture- -prog-culture-
 +-seculture- -sec-culture-
 +-dirculture- -dir-culture-
 +</​code>​
 +
 +----
 +
 +contact : [[http://​twitter.com/​ychaouche|@ychaouche]] yacinechaouche at yahoocom
  

QR Code
QR Code bashparsing (generated for current page)