๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ปTech/๐ŸงLinux

[๋ฆฌ๋ˆ…์Šค] ์‰˜ ์Šคํฌ๋ฆฝํŠธ ๊ฐœํ–‰๋ฌธ์ž ์‚ฌ์šฉ

by _viper_ 2019. 9. 4.
๋ฐ˜์‘ํ˜•

mysql ๊ฒฐ๊ณผ๋ฅผ ๋ณ€์ˆ˜์— ๋„ฃ์—ˆ๋Š”๋ฐ ๊ฐœํ–‰๋ฌธ์ž๋“ค์ด '\n' ๋ฌธ์ž๋กœ ์ž…๋ ฅ๋˜์–ด ๋ณ„๋„๋กœ split ํ•ด์ค˜์•ผ ํ–ˆ์–ด์š”

2019/08/05 - [Programming/Linux] - [Linux] mysql ์ ‘์† ๋ฐ ์ฟผ๋ฆฌ ์‹คํ–‰ ๋ช…๋ น์–ด

 

echo -e ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค

IFS๋กœ๋„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”

 

๐Ÿ’ก ๊ฐœํ–‰๋ฌธ์ž ์‹คํ–‰ ๋ฐฉ๋ฒ•

  • e์˜ต์…˜์€ escape ๋ฌธ์ž๋“ค์„ ์‹คํ–‰
RESULT="aaa\nbbb\nccc\n"
echo -e $RESULT

## ์‹คํ–‰ ๊ฒฐ๊ณผ
aaa
bbb
ccc