Reputation: 41
I used AWK command to split a string like this
LINE="91345|/2015/01/30/Launch Trailer - Might Magic Heroes III HD Edition(1).mp4"
Between Might and Magic have two whitespaces
And I run command
video_path=`echo $LINE|awk -F$separator '{print $2}'`
After running only a single whitespace between Might and Magic
/2015/01/30/Launch Trailer - Might Magic Heroes III HD Edition(1).mp4
How can I keep two whitespaces in string I recieved.
Sory for my bad English :( !!!
Upvotes: 0
Views: 36
Reputation: 20688
echo $LINE
should be echo "$LINE"
:
video_path=$(echo "$LINE" | awk -F$separator '{print $2}')
Upvotes: 1
Reputation: 784908
Use quotes in echo
statement to preserve all whitespaces:
video_path=$(echo "$LINE" | awk -F "$separator" '{print $2}')
Upvotes: 2