kr123
1
hi, please help me with the below
1)i have a file like below with data
389096
389097
389098
..and i need some thing like below
'389096','ZZ1111'
'389097','ZZ1111'
'389098','ZZ1111'
2)i have a file like below with data
8300003225
8300003223
8300006494
..and i need the first digit replaced with letter z like
z300003225
z300003223
z300006494
thanks
Where does the 'zzz111' come from?
As for the second:
awk '{ $1="z" substr($1, 2) } 1' filename > output
kr123
3
zzz111 is a dummy value i want to insert next to the values
for the second answer i got the below error
bash-3.00$ awk '{ $1="z" substr($1, 2) } 1' pools > output
awk: syntax error near line 1
awk: bailing out near line 1
xbin
4
In your first example:
sed "s/.*/'&','ZZ111'/g" infile > outfile
In the second example:
sed 's/^8/z/g' infile > outfile
sed "s/$/,'ZZ111'/" infile > outfile
sed 's/^[0-9]/z/' infile > outfile
--ahamed
xbin
7
Well, that doesn't wrap the numbers in the "infile" with single quotes though I agree that the "g" at the end of the sed statements could be removed.
My bad, I didn't notice that!
--ahamed