开发者

Split a line of text in bash using SOH delimiter

How do I split a line of t开发者_开发技巧ext in bash using SOH delimiter?


you can use the octal value of SOH as a delimiter using awk.

$ awk -F"\001" '{print $1}' file


You can set the IFS variable to change the delimiter between words. (Don't forget to save the old value so you can restore it when you're done.)

Based on a quick google I assume "SOH delimiter" is the character with code 1, so you need to get that odd character into IFS:

IFS=`echo -e '\01'`

If that's not enough, you probably need to expand on "split a line of text". What do you want to split it into?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜