Search Results

Search: Posts Made By: freegnu
3,245
Posted By ctsgnb
# uname -a | nawk '{sub($2,"xxxxxxxx",$0)}1' ...
# uname -a | nawk '{sub($2,"xxxxxxxx",$0)}1'
SunOS xxxxxxxx 5.10 Generic_141414-01 sun4u sparc SUNW,Sun-Fire-V490
# echo...
3,245
Posted By michaelrozar17
I believe below one would help to resolve sed...
I believe below one would help to resolve
sed 's/\(<cr>\)\1*/<CR>/g' inputfile
42,322
Posted By sk1418
replace all x into y? or only in 2nd line? ...
replace all x into y?
or only in 2nd line?
or in lines that match some pattern? e.g. starts with 5?

the codes below change any x-fields to y only in the 2nd line.
awk '{if...
3,398
Posted By gaurab
Using awk If you just want to replace the . in...
Using awk
If you just want to replace the . in the 3rd column

awk '{if($3==".") print $1" "$2" NA";else print}' infile
3,398
Posted By ctsgnb
because dot has a special meaning when...
because dot has a special meaning when interpreted as a regular expression it means 'any single character' so it needs to be "escaped" using the backslash

printf ",s/\./NA/\nw\nq\n" | ed -s infile
3,398
Posted By rbatte1
If it is literally a replace of the full stop...
If it is literally a replace of the full stop character with NA, then you could try:-
echo ":%s /\./NA/\nwq"|vi filename

It may not work if:-

Your file has long lines over 2048 bytes,
Your...
3,398
Posted By ctsgnb
sed 's/\./NA/g' infileOr ... if you never have...
sed 's/\./NA/g' infileOr ... if you never have more than 1 dot per line you can go with
sed 's/\./NA/' infile

if you wan only replace the single dot , not those like 12.65849

then
sed...
8,813
Posted By alister
The correct way to print an arbitrary string with...
The correct way to print an arbitrary string with printf is printf "%s", $0
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 04:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy