syker
syker

Reputation: 11272

Split a line of text in bash using SOH delimiter

How do I split a line of text in bash using SOH delimiter?

Upvotes: 1

Views: 7446

Answers (2)

ghostdog74
ghostdog74

Reputation: 342353

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

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

Upvotes: 3

Andy Mortimer
Andy Mortimer

Reputation: 3707

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?

Upvotes: 0

Related Questions