Article 5GZAT tab seperated textfile and write each field in a variable

tab seperated textfile and write each field in a variable

by
Midyr
from LinuxQuestions.org on (#5GZAT)
Hello,

I have a textfile with tab separate content.

The goal is, to insert fiels3 in some lines.

The first line is without field3.

filed6 contains a space, which makes the trouble
Code:F1 F2 F4 F5 F 6
F1 F2 F3 F4 F5 F 6My idea was, to do this with awk, and write each field in a variable but it dosen't work as expected.
Code:#!/bin/bash

while read
do

xy=($(awk -F '\t' '{print $1, $2, $3, $4, $5, $6}' ))
echo "Status; "${xy[0]}
echo "Start: "${xy[1]}
echo "End: "${xy[2]}
echo "Snr:: "${xy[3]}
echo "Ubknn: "${xy[4]}
echo "CN: "${xy[5]}
done < index.txtCode:
Status; F1
Start: F2
End: F3
Snr:: F4
Ubknn: F5
CN: FAs you can see, F6 is cuted after the space.

Any idea to this?

Thanks

Midyrlatest?d=yIl2AUoC8zA latest?i=xjbpj6MqEzU:8vtFIimytFQ:F7zBnMy latest?i=xjbpj6MqEzU:8vtFIimytFQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=xjbpj6MqEzU:8vtFIimytFQ:gIN9vFwxjbpj6MqEzU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments