Hi
I have a file with numbers like this :
123
456
6798
9073233
12
8644
Now, I need to insert parentheses to each and every line like below :
(123)
(456)
(6798)
(9073233)
(12)
(8644)
can anyone tell me a solution?
Hi
I have a file with numbers like this :
123
456
6798
9073233
12
8644
Now, I need to insert parentheses to each and every line like below :
(123)
(456)
(6798)
(9073233)
(12)
(8644)
can anyone tell me a solution?
You use the following command to achieve it.
sed 's/\(.*\)/\(\1\)/' <filename>
Use this,
sed -r "s/(^[0-9]+$)/(\1)/g" file > opfile
or,
sed -e 's/^/(/g' -e 's/$/)/g' file
awk '{print "("$0")"}' urfile
In gvim you can
:%s/\d\+/(&)/g
Thanks to all . It works fine
Try:
sed 's/.*/{&}/' file
using PERL:-
perl -wlpe 's/$_/($&)/;' infile.txt
perl -wple 's/($_)/($1)/;' infile.txt
;);)