Hi,
I have a huge text file with lots of lines like:
a 23232 23232 545 3434 DATA4545454_1 454 4646466 3434 3567
a 23232 23267632 545 3436764 DATA454545567564__1 454 464675466 3434 3
a 232676732 232676732 545 3434 DATA4545454_1 454 46457566466 3457534 35675
In all of them I would like to get rid of everything which is after DATA*, so ...
I made this bash one-liner which I use to list Weblogic instances running along with their full paths.This works well when I run it from the shell.
/usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print $2}' | sed 's/weblogic.policy//' | sed 's/security\///' | sort
I tried to incorpora...
I have this use case of an xml file with input like
Input:
<abc a="1">
<val>0.25</val>
</abc>
<abc a="2">
<val>0.25</val>
</abc>
<abc a="3">
<val>0.35</val>
</abc>
...
Output:
<abc a="1"><val>0.25</val></abc>
<abc a="2"><val>0.25</val></abc>
<abc a="3"><val>0.35</val></abc>
I have around 200K lines in a file in the In...
I have a giant text file (about 1,5 gigabyte) with xml data in it. All text in the file is on a single line, and attempting to open it in any text editor (even the ones mentioned in this thread: http://stackoverflow.com/questions/159521/text-editor-to-open-big-giant-huge-large-text-files ) either fails horribly or is totally unusable due...
Greetings,
I need to store the filename of a log into a variable so my script can perform some checks on the daily log files. These logs always have a different name because they have a timestamp in the name. Currently I'm using a hodge podged method that pipes an ls command to sed, sort, cut, and tail in order to get the name out.
C...
ABCDchinchwad18-Mar-2010-11.sql.zip
ABCDsolapur18-Mar-2010-10.sql.zip
How do I find the string between "ABCD" and the date "18-Mar-2010"
Expected resuts:
chinchwad
solapur
...
Remove first comma on each line in a file. I presume sed is needed.
...
Hello i have this line...
"00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter"
how can i get the first numbers until VGA with SED in Bash script?
Thanks!
...
I have a command which lists Weblogic instances directories on a server.I want to display contents of a file in the parent directory of each directory listed.
An additional feature would be to display the name of the file in addition to displaying the contents
/usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | gr...
I'm wondering if it's possible (recommended might be the better word) to use sed to convert URLs into HTML hyperlinks in a document. Therefore, it would look for things like:
http://something.com
And replace them with
<a href="http://something.com">http://something.com</a>
Any thoughts? Could the same also be done for emai...
I'm trying to remove the carriage returns (\r) from a file with the following command on AIX, but it's also removing my last line. Any suggestions?
sed -e 's/\r\n/\n/g' ./excprule > ./excprule.tst
Command sequence:
dev1:> sed -e 's/\r\n/\n/g' ./test_file > ./test_file.tst
dev1:> diff test_file.tst test_file
diff: 0653-827 Missing n...
Hi,
How can I can insert the contents of a file into another file right before a specific line using sed?
example I have file1.xml that has the following:
<field tagRef="376">
</field>
<field tagRef="377">
</field>
<field tagRef="58">
</field>
<group ref="StandardMessageTrailer"...
Hi,
given a plain text document with several lines like:
c48 7.587 7.39
c49 7.508 7.345983
c50 5.8 7.543
c51 8.37454546 7.34
I need to add some info 2 spaces after the end of the line, so for each line I would get:
c48 7.587 7.39 def
c49 7.508 7.345983 def
c50 5.8 7.543 def
c51 8.37454546 7.34 def
I need to do this for thousan...
How can I do a sed regex swap on all text that preceed a line matching a regex.
e.g. How can I do a swap like this
s/foo/bar/g
for all text that precedes the first point this regex matches:
m/baz/
I don't want to use positive/negative look ahead/behind in my sed regex, because those are really expensive operations on big files.
...
i have a renamed js file which i have to call in each of my php page. Now i want to replace that old name with the new one using shell.
what iam using is this :-
sed -i ’s/old/new/g’ *
but this is giving the following error :-
sed: -e expression #1, char 1: unknown command:
now how can i do this replacement??
...
EDIT
i have something like this in a file:
imagecolor=0
arrayimagecolorcopy=0
arrayimagecolorcopy3d=0
when i use sed -i -e 's/imagecolor=0/imagecolor=1/' it will change 1 and 2 line. But i only want it to replace first line.
i also tried sed with \< \ > and \b \b, but no luck. Could it be the '=' sign? Do we have something like -w ...
Hi, what would be the best way to remove whitespace only around certain character. Let's say a dash - Some- String- 12345- Here would become Some-String-12345-Here. Something like sed 's/\ -/-/g;s/-\ /-/g' but I am sure there must be a better way.
Thanks!
...
How can I remove every odd line, using sed?
remove
keep
remove
keep
remove
...
...
I have something to do that must be finished before 4.00PM.
I want to create a batch file with awk, grep or sed that keeps all lines beginning with 'INSERT' and deletes the other lines.
After this, I want to replace a string "change)" by "servicechange)" when the 3rd word in the treated line is "donextsit".
Please explain how to d...
I have am trying to use sed to get some info that is encoded within the path of a file which is passed as a parameter to my script (Bourne sh, if it matters).
From this example path, I'd like the result to be 8
PATH=/foo/bar/baz/1-1.8/sing/song
I first got the regex close by using sed as grep:
echo $PATH | sed -n -e "/^.*\/1-1\.\([0...