0

I have a File with below content like below

123\x01abc\x01bcd\x01\123  

I tried using below two commands in bash:

echo "123\x01abc\x01bcd\x01\123" | awk -F'\\x01' '{print $1}'    
echo "123\x01abc\x01bcd\x01\123" | awk -F $'\x01' '{print $1}'  
echo "123\x01abc\x01bcd\x01\123" | awk -F\\x01' '{print $1}'

But all of them producing below output:

123\x01abc\x01bcd\x01\123  

When tried with below command:

echo "123\x01abc\x01bcd\x01\123" | awk -F\x01' '{print $1}'  

Above command giving below output, instead of 123:

123\  

I want output as '\x01' separated fields. When I search AWK treating \x as hex and so, is AWK expecting to pass hex as field separator after \x?

Thanks in advance!

0 Answers0