10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I am processing text files looking for a string and replacing the first occurrence of the string with something else.
For the text,id Name
1 methyl-(2-methylpropoxy)-oxoammonium
2 N-amino-N-(methylamino)-2-nitrosoethanamine
3 3-methoxy-3-methyloxazolidin-3-ium... (12 Replies)
Discussion started by: LMHmedchem
12 Replies
2. Shell Programming and Scripting
Im trying to use sed to print value that matches the value in variable and all lines after that.
grep "Something" test.txt | sed -e '/{$variable}/,$b' -e 'd'
I cant get it work, if I replace the $variable with the value it contains, it works fine... (10 Replies)
Discussion started by: olkkis
10 Replies
3. Shell Programming and Scripting
All
I am trying to produce the following in /etc/ssh/sshd_config,
# IPv4 only
#ListenAddress 0.0.0.0
# IPv4 & IPv6
ListenAddress ::
to
# IPv4 only
ListenAddress <user-entry>
ListenAddress <user-entry>
# IPv4 & IPv6
#ListenAddress ::
The number of user entries can vary.
... (1 Reply)
Discussion started by: miyoung999
1 Replies
4. Shell Programming and Scripting
I am writing a script with a sed call that needs to use a variable and still have quotations be present in the substitution.
Example:
sed -i "s/Replacable.\+$/Replaced="root@$VAR"/g"
this outputs:
where $VAR = place
Replaced=root@place
and i need
Replaced="root@place"
... (2 Replies)
Discussion started by: mcdef
2 Replies
5. Shell Programming and Scripting
GNU sed version 4.1.4 on Windows XP SP3 from GnuWin32
I think that I've come across a seemingly simple text file change problem on a INI formatted file that I can't do with SED without side effects edge cases biting me. I've tried to think of various ways of doing this elegantly and quickly... (5 Replies)
Discussion started by: JakFrost
5 Replies
6. Shell Programming and Scripting
I'm trying to get sed to cut and replace using variables, but it doesnt seem to work, when I run this the mod time of the file does get updated. Is my syntax incorrect in the sed command?
Thanks
#!/usr/bin/ksh
#Modify header
set -x
HEAD=$(cat PBN2CPR1.TXT | awk 'BEGIN { FS = ","... (1 Reply)
Discussion started by: ddurden7
1 Replies
7. Shell Programming and Scripting
HELP!!!
I'm keep getting "sed: Function s/PETS/dog cannot be parsed."
I have 2 files that list...
# cat FILE1.txt
dog
cat
mouse
# cat FILE2.txt
my pets are
PETS
I put this into a variable...
# A=`cat FILE1.txt`
# sed "s/PETS/$A" FILE2.txt > FILE3.txt (5 Replies)
Discussion started by: Zenwork
5 Replies
8. Shell Programming and Scripting
Hi,
I'm trying to use sed to delete the last three lines of a file. I currently have:
# get the amount of lines in the file
foldernum=`wc -l File_In.txt | cut -c1-8`
# remove the lines in the file
sed "${foldernum}-3,${foldernum}d" File_In.txt > File_Out.txt
I get the error - sed:... (5 Replies)
Discussion started by: Mr_Plow
5 Replies
9. UNIX for Advanced & Expert Users
a=2
sed -n "/${a}/p" list | cut -d "#" -f1
this dosen't print only second line.....
how can it b done.... (1 Reply)
Discussion started by: bishweshwar
1 Replies
10. UNIX for Dummies Questions & Answers
All -
I have a situation where I have some hardcoded directories in a file. I want to be able to search for string that I know will always be the same in each environment and then replace that entire line with the new environment specific information. I am using the sed command to do this, but... (2 Replies)
Discussion started by: Mark_A_Tritz
2 Replies