I want to delete all the text between a pair of "};" which contains a particular keyword.
What i want is
input:
}; text text KEYWORD text text };
Output:
}; };
Suggest me a simple regular expression. I know 'sed' is to be used.
...
I have the following input file that you might recognize as a debian Packages file:
Package: nimbox-apexer-sales
Version: 1.0.0-201007241449
Architecture: i386
Maintainer: Ricardo Marimon <[email protected]>
Installed-Size: 124
Depends: nimbox-apexer-root
Filename: binary/nimbox-apexer-sales_1.0.0-201007241449_i386.deb
Size: 68880
MD5...
Hello,
I have following string
â â³ eGalax Inc. USB TouchController id=9 [slave pointer (2)]
â â³ eGalax Inc. USB TouchController id=10 [slave pointer (2)]
and would like to get the list of id ? How this can be done using sed or something else ?
Regards,
Levon
...
I have already made a regex which should work, but it doesn't work.
echo "FileName.17:09:2010 4.16.PM.720p.mp4" | sed -E 's/\d{2}:\d{2}:\d{4}\ (\d|\d{2})\.(\d{2}|\d)\.((AM)|(PM))//g'
Should output: FileName..720p.mp4
But instead outputs the same "FileName.17:09:2010 4.16.PM.720p.mp4".
...
Hi, all!
I have an xml file as follows:
<Exchange DateTime="17/09/2010 18:00:00">
<Content Percent="0.20" Price="63.862" Sign="1"/>
<Content Percent="0.25" Price="80.989" Sign="1"/>
<Content Percent="0.07" Price="1.4970" Sign="1"/>
<Content Percent="-0.31" Price="1.9530" Sign="-1"/>
</Exchange>
There are 4 variables called A,B,C,D.
...
Hello,
I have a big apache log file and I need to filter that and leave only (in a new file) the log from a certain IP: 192.168.1.102
I try using this command:
sed -e "/^192.168.1.102/d" < input.txt > output.txt
But "/d" removes those entries, and I needt to leave them.
Thanks.
...
I'm running a command line like this:
filename_listing_command | xargs -0 action_command
Where filename_listing_command uses null bytes to separate the files -- this is what xargs -0 wants to consume.
Problem is that I want to filter out some of the files. Something like this:
filename_listing_command | sed -e '/\.py/!d' | xargs ac
...
I'm trying to create a function that goes to a specific directory, and if a single argument is specified add that to the directory string. But no matter what I try I can't get it to work and bash always reports that X is not a directory even though if I copy/paste it to a new command line it works from there.
function projects ()
{
DI...
I have a file and a list of string pairs which I get from another file. I need substitute the first string of the pair with the second one, and do this for each pair.
Is there more efficient/simple way to do this (using Perl, grep, sed or other), then running a separate regexp substitution for each pair of values?
...
I know I can "probably" fix them by using "flip -u" (cygwin flip) which basically removes one of the 0xd's leaving the file with DOS style line endings (0x0d 0x0a) (of course, technically speaking this might be considered a bug!).
But the other side of it is that i'd like to do this selectively, ensuring that what I'm fixing really is a...
Hi,
I have a date value stored in a unix korn shell variable
VALUE="2010_09_23"
I want to change it to "23-Sep-2010" and store it in VALUE1. How can i do it?
VALUE1="23-Sep-2010"
...
Is it possible to keep only the last 10 lines of a lines with a simple shell command?
tail -n 10 test.log
delivers the right result, but I don't know how to modify test.log itself. And
tail -n 10 test.log > test.log
doesn't work.
...
Hi
I wrote a piped shell command that has multiple pipes in it that works great. I now want to put this in the form of a (tidy) shell script. Here is the script:
#!/bin/bash
for number in `cat xmlEventLog_2010-03-23T* | sed -nr "/<event eventTimestamp/,/<\/event>/ {/event /{s/^.*$/\n/; p};/payloadType / {h; /protocol/ {s/.*protocol=\"(...
i have a template, with a var LINK
and a data file, links.txt, with one url per line
how in bash i can substitute LINK with the content of links.txt?
if i do
#!/bin/bash
LINKS=$(cat links.txt)
sed "s/LINKS/$LINK/g" template.xml
two problem:
$LINKS has the content of links.txt without newline
sed: 1: "s/LINKS/http://test ...": bad...
I've got a csv file where the left most column contains an ID field. Is there a clever way I can use any utility programs such as sed to find any ID's that are used more than once?
...
Hi,
I am trying to insert some copy-right information into the beginning of some source files. I know that using sed in the following way:
sed "1iSome copyrighted information." sample.txt
would insert the text "Some copyrighted information" to the beginning of sample.txt.
I need to insert text from a file to the beginning of sample...
I'm using PWD to get the present working directory. Is there a SED or regex that I can use to, say, get the full path two parents up?
...
I wonder if there is a comparison between the features of various regex metacharacters in various implementations.
The sort of thing I am looking for is a table like
Language Perl sed
grouping ( ) \( \)
Languages I am interested in are Perl, Sed Java Javascript
...
Hello,
i need a 1liner to remove the first 5 chars on any line of a text file, but i dont know sed, could anyone help me please?
Thanks in advance
Chris
...
hi, I am in the process of learning makefile creation.
Current target is to scan the $(SOURCEDIR) for .c files and create (according to that lise of .c file paths in the format of /path/file.c) a nice $(VPATH) so I do not need to use recursive makefiles (aka pain in the a..).
Atm I am stuck with this, where $(SOURCETREE) will be empty ...