Home > computers > linux > bash > bashparsing | About
Home > Computers > programming > scripting > 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'.

# 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-

contact : @ychaouche yacinechaouche at yahoocom


QR Code
QR Code bashparsing (generated for current page)