Hi all
I am trying this simple command:
a="abc abc"
echo $a
output is: abc abc
But expected output shoould be :abc abc
i.e spaces in real string are geting truncated to one space everytime.
Plz Help.
Hi all
I am trying this simple command:
a="abc abc"
echo $a
output is: abc abc
But expected output shoould be :abc abc
i.e spaces in real string are geting truncated to one space everytime.
Plz Help.
Wrap $a within double quotes i.e. "$a"
cat my_file | while read line
do
last=`echo $line | cut -c 3-`
echo "$last"
done
my_file:
1US8738297897918[space][space][space]0[space][space]0[space][space]0
1US8738297897918[space][space][space]0[space][space]0[space][space]0
1US8738297897918[space][space][space]0[space][space]0[space][space]0
Expected output:
8738297897918[space][space][space]0[space][space]0[space][space]0
8738297897918[space][space][space]0[space][space]0[space][space]0
8738297897918[space][space][space]0[space][space]0[space][space]0
Current Output:
8738297897918[space]0[space]0[space]0
8738297897918[space]0[space]0[space]0
8738297897918[space]0[space]0[space]0
Plz Help !
The read command removes leading and traling Input Field Separators.
The echo command doesn't preserve multiple IFS between argument strings.
while IFS= read line
do
last=`echo "$line" | cut -c 3-`
echo "$last"
done <my_file
Jean-Pierre.
It worked !