I have a shell script which is reading the value of a variable line by line. I need to remove certain characters from every line.
What I have - $sample_variable -
Data 0 start; 1 ABCD0;2 EFGH0;3 IJKL0;4 MNOP0;5 QRST0;6 end;
What I want -
start
ABCD0
EFGH0
IJKL0
MNOP0
QRST0
end
Code that I have written -
IFS=$';'
for j in $sample_variable
do
j=$j | cut -d ' ' -f3-
echo $j
j=${j// /''}
echo $j
echo $j >> output.txt
done
I am writing the output in a txt file.But, the file is getting written as output.txt -
start
1ABCD0
2EFGH0
3IJKL0
4MNOP0
5QRST0
6end
How do I remove the numbers occuring at the beginning also?