I have the following XML output when I grep for "Server":
<Server id="1" src="/other/Server/PRX01/PRX01.xml"/>
<Server id="2" src="/other/Server/PRX01/PRX02.xml"/>
<Server id="3" src="/other/Server/PRX01/PRX03.xml"/>
<Server id="4" src="/other/Server/PRX01/PRX04.xml"/>
I need to be able to take this output and sed/awk or some other to...
Dear all,
I would like to extract some lines from a text file, I have started to tweak sed lately,
I have a file with the structure
88 3 3 0 0 1 101 111 4 3
89 3 3 0 0 1 3 4 112 102
90 3 3 0 0 1 102 112 113 103
91 3 3 0 0 2 103 113 114 104
What I would like to do is to extract the information according to the second column, I use st...
My HTML code has the following line.
<TH>column1</TH><TH>column2</TH><TH>column3</TH>
Can I use sed tool to replace the column1 with "Name", column2 with "Surname" ...
<TH>Name</TH><TH>Surname</TH><TH>City</TH>
I have the list of the columns in a echo statement of my shell script.
echo 'Name, Surname, City'
These 3 values needs ...
i need to remove all multibyte characters from a file, i dont know what they are so i need to cover the whole range.
I can find them using grep like so:
grep -P "[\x80-\xFF]" 'myfile'
Trying to do a simular thing with sed, but delete them instead.
Cheers
...
I need to create an output text file by deleting the first two lines of the input file.
At the moment I'm using
sed "1,2d" input.txt > output.txt
I need to do this for thousands of files, so am using python:
import os
for filename in somelist:
os.system('sed "1,2d" %s-in.txt > %s-out.txt'%(filename,filename))
but this is quite slo...
How do I extract text in between strings with very specific pattern from a file full of these lines? Ex:
input:a_log.gz:make=BMW&year=2000&owner=Peter
I want to essentially capture the part make=BMW&year=2000. I know for a fact that the line can start out as "input:(any number of characters).gz:" and end with "owner=Peter"
...
I have a txt file that looks something like this
-----------------------------------
RUNNING PROCESSES
-----------------------------------
ftpd
kswapd
init
etc..
---------------------------------
HOSTNAME
--------------------------------
mypc.local.com
With sed I want to just get one section of this file. So j...
Possible Duplicate:
modify a datastream on the fly
I need to hijack and modify a datastream. The stream consists of fixed-width commands. Each command is a new line, and the documentation says that each command starts and ends with an STX/ETX (start and end of text) pair.
The sending system is using serial, but is attacked to...
Dear all,
I read about sed last week and now, I do some extraction from a file using sed, that is fine,
Now, I would like to change the data in the first column to the line number say
1 3 3 0 0 0 1 3 35 34
16 3 3 0 0 0 34 35 33 19
31 3 3 0 0 0 19 33 71 68
46 3 3 0 0 0 68 71 72 69
61 3 3 0 0 0 69 72 73 70
76 3 3 0 0 0 70 73 67 53
and...
I've got a particular situation where I need to remove the operations of a series of commits in Subversion repository. Entire contents of (/trunk /tags /branches) were tagged and subsequently removed when the mistake was realized. I would simply use svndumpfilter to remove the offending nodes, but someone re-used the bad tag name at a la...
hi all
how to append some text by sed or awk after matching sequential two lines in file?
remark (need to ignore empty lines if exist)
for example
we want to append the text "this is the new line" after the following match lines in file
vopied 13783/tcp # VOPIED Protocol
vopied 13783/udp # VOPIED Protocol
this is the new ...
hi all
how to print all lines between
"section B ("
To the next "section" word that begin in line?
section A (
.
.
)
section B (
.
.
)
section C (
.
.
)
...
sed -e 's/ *-\{0,1\},\{0,1\} *[Pp][Aa]\{0,1\}[Rr]\{0,1\}[Tt].\{0,1\} *\([0-9]\{1,\}\) *$/ (\1)/'
I'm piping titles through this from an iTunes AppleScript. This should convert any title with a Part designation at the end to a parenthetical format
For instance, Best of Both Worlds, Part 2 becomes Best of Both Worlds (2).
The trouble r...
I want to append something at the end of a certain line(have some given character).
For example, the text is:
Line1: I just want to make clear of the problem
Line2: Thanks to all who look into my problem
Line3: How to solve the problem?
Line4: Thanks to all.
Then I want to add "Please help me" at the end of
Line2: Thanks to all...
Hi I need to add the following line to the end of a config file:
include "/configs/projectname.conf"
to a file called lighttpd.conf
I am looking into using sed to do this, but i cant work out how to only insert it if the line doesnt already exist. Is anyone able to enlighten me?
Thanks in advance,
Ben
...
I have a file with many lines in it like this: (this is the output of windows tasklist)
"wmiprvse.exe","3596","Console","0","5,632 K","Running","NT AUTHORITY\NETWORK SERVICE","0:00:00","N/A"
and I want to change it to this:
wmiprvse.exe,NT AUTHORITY\NETWORK SERVICE,N/A
I used sed (unxutils) to reformat the output:
But it d...
I have the following sed command. I need to execute the below command in single line
cat File | sed -n '
/NetworkName/ {
N
/\n.*ims3/ p
}' | sed -n 1p | awk -F"=" '{print $2}'
I need to execute the above command in single line. can anyone please help.
Assume that the contents of the File is
System.DomainName=shayam
System.Add...
I'm trying to grovel through some other processes environment to get a specific env var.
So I've been trying a sed command like:
sed -n "s/\x00ENV_VAR_NAME=\([^\x00]*\)\x00/\1/p" /proc/pid/environ
But I'm getting as output the full environ file. If I replace the \1 with just a static string, I get that string plus the entire environ ...
hi all
I use the following sed command to remove the "line number" string from file
sed -i s'/line number//g' file
but what I need to change in sed syntax in order to remove the "line number"
only if it exist in the last line of the file?
Lidia
...
hi all
I use the following sed command in UNIX Solaris
From SOLARIS machine
sed -i '$ s/OLD/NEW/g' test
sed: illegal option -- i
can some one have idea what the illegal option in Solaris (in place "-i" option in linux I need other option in Solaris with the same effect)
lidia
...