Quote:
Originally Posted by
RudiC
If the commands work when used with var=xyz, then I'd bet your "dynamic assignment" kills the code. Sure the file being grepped has NO <CR> characters?
found contro characters at the end of each line in the file.. $
unable to remove it. do i have to rectreate the file?
---------- Post updated at 03:17 PM ---------- Previous update was at 01:27 PM ----------
Quote:
Originally Posted by
RudiC
If the commands work when used with var=xyz, then I'd bet your "dynamic assignment" kills the code. Sure the file being grepped has NO <CR> characters?
Hi RudiC
here is what i have got:
Input File:
Group Name ::-,,,,,,,
ADIDAS,,,,,,,,,,,,,,,,,,,,,,,,,
,54,,3607345380247,,,,,,,,,ADIDAS DEO FORCE 150ML&,,,,,,175 ,,,,,,166 ,,,1 ,,,,,166.25
Required output:
ADIDASGroup Name ::-,,,,,,,
ADIDAS,,,,,,,,,,,,,,,,,,,,,,,,,
ADIDAS,54,,3607345380247,,,,,,,,,ADIDAS DEO FORCE 150ML&,,,,,,175 ,,,,,,166 ,,,1 ,,,,,166.25
To get adidas in a avaribale i am using following coomand:
variable=$(grep "Group" F5 | sed 's/Group Name[ ]*//g;s/,//g;s/://g;s/-//g')
works abslty fine. Not to append the value of this variable at the first position o the line m using
awk -v V="$variable" '{$0=V $0}1' F5
Output:
Group Name ::-,,,,,,,
ADIDAS,,,,,,,,,,,,,,,,,,,,,,,,,
,54,,3607345380247,,,,,,,,,ADIDAS DEO FORCE 150ML&,,,,,,175 ,,,,,,166 ,,,1 ,,,,,166.25
No control chars.. checked throughout.. crreated a new file issue stil persist