Results 1 to 2 of 2
Hey all,
I'm wondering why the following returns what it does..
bash -x tells me:
Using cut:
Code:
test=`cat avvdat.ini | grep avvdat-*.zip | cut -d= -f2`
test=$'avvdat-6477.zip\r'
Same with ...
- 09-23-2011 #1Just Joined!
- Join Date
- Feb 2007
- Posts
- 6
cat+grep+sed/cat+greg+cut output to variable
Hey all,
I'm wondering why the following returns what it does..
bash -x tells me:
Using cut:
Same with sed:Code:test=`cat avvdat.ini | grep avvdat-*.zip | cut -d= -f2` test=$'avvdat-6477.zip\r'
Code:test=`cat avvdat.ini | sed -n '1,/^FileName/ s/^.*avv/avv/1p'` test=$'avvdat-6477.zip\r'
But if I echo, I get right what I want
Basically I'm comparing it to a file name, and I'm getting results telling me that that the two are different, because of how the variable is formulated.Code:echo $test avvdat-6477.zip
Thanks in advance,
Chris
- 09-25-2011 #2Just Joined!
- Join Date
- Aug 2011
- Posts
- 48
You might have a dos2unix issue. Run dos2unix and try your script again.
If that doesn't work use od -tx1 -c <filename> to see what the end of line is. Linux, it would be 0x0a.
You will have to change your sed command to handle the extra char that is in the file.


Reply With Quote