Search Results

Search: Posts Made By: bhavanabahety
7,743
Posted By PrasadAruna
delete the line with a particular string in a file using sed command.
Hello,

I want to delete all lines with given string in file1 and the string val is dynamic.
Can this be done using sed command.

Sample:
vars="test twinning yellow"

for i in $vars
do...
43,546
Posted By matrixmadhan
to add with Vino, -i option in sed is...
to add with Vino,

-i option in sed is available only in GNU distribution
4,827
Posted By pinnacle
Sir, The following error: awk: syntax...
Sir,

The following error:
awk: syntax error near line 1
awk: bailing out near line 1
4,827
Posted By vgersh99
If on Solaris, use /usr/bin/nawk or...
If on Solaris, use /usr/bin/nawk or /usr/xpg4/bin/awk
1,842
Posted By Scrutinizer
Yes, with every iteration you can print your...
Yes, with every iteration you can print your processed line bit and the some extra line..
14,773
Posted By Rakesh Ranjan
There may be many ways of doing this i'll...
There may be many ways of doing this i'll describe just one & probably the easiest one.
Assuming that u r taking input from a fixed file 'input.txt' (whose content u might be changing when u have to...
2,131
Posted By balajesuri
What are you exactly trying to achieve? You may...
What are you exactly trying to achieve?
You may also try this:
sed 's/axyz.bnd$/& ===> grant permission/' file
2,131
Posted By MadeInGermany
Please use code tags in your posts! Standard...
Please use code tags in your posts!
Standard sed is awful: it wants the insertion text on a new line.
sed '/axyz.bnd/ i\
grant permissions given ' file1 sed '/axyz.bnd/ a\
grant permissions given...
3,106
Posted By pamu
Use code tags for code and data sample. Try ...
Use code tags for code and data sample.

Try

sed 's/patternstring/\n new line string/' file
1,842
Posted By Scrutinizer
Use a while read loop and cut the line using...
Use a while read loop and cut the line using parameter expansion (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02): ${line##*/}
1,842
Posted By Jotne
awk -F/ '{print $NF}' infile advc0007.bnd ...
awk -F/ '{print $NF}' infile
advc0007.bnd
naac6115.bnd
trkc4822.bnd
trkc4823.bnd
cmpc0105.bnd
1,842
Posted By balajesuri
while read line do x=$(echo "$line" | sed...
while read line
do
x=$(echo "$line" | sed 's:.*/::')
# work with $x
echo $x
done < file
Showing results 1 to 12 of 12

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