07-06-2009
use sed do batch wildcard string replace
Hi,
Here is what I want to do
I want to search local directory and its sub directory, all the files which contain any string like _12345, then remove this string.
String is a combination of _ plus a random integer number.
For example, here is one line in a file before
<properties xmi:id="Property_1246046473688" name="com.ibm.websphere.wxdcgProductVersion" value="6.1.0.4"/>
after change, it should become
<properties xmi:id="Property" name="com.ibm.websphere.wxdcgProductVersion" value="6.1.0.4"/>
Please help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i got text file and contain....
SKYPE Dec 11 09:26:05 IN=eth0 OUT=eth1 SRC=75.38.161.80 DST=192.168.1.56 PROTO=UDP SPT=30645 DPT=12630 LEN=66
SKYPE Dec 11 09:26:05 IN=eth1 OUT=eth0 SRC=192.168.1.56 DST=118.109.39.86 PROTO=UDP SPT=12630 DPT=15889 LEN=75
SKYPE Dec 11 09:26:05 IN=eth1 OUT=eth0... (2 Replies)
Discussion started by: slackman
2 Replies
2. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
3. Shell Programming and Scripting
Hi
I am having a csv file in which lots of data are available wherein i need to find a particular kind of data and replace it with null value.
here is the sample data..
I need to find the string starting with 404-064- and up to the first space i have to remove the data and keep the... (4 Replies)
Discussion started by: aemunathan
4 Replies
4. Shell Programming and Scripting
Hi
I would like to batch delete the "note" entry from bib files. The start would be defined by "note ={" and the end by "}." (see example bib entry below).
I tried the following command which does not have any effect:
cat input.bib| sed -e 's/note = {.*}.//' > output.bib
Any help would... (2 Replies)
Discussion started by: gerggeismann
2 Replies
5. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies
6. Shell Programming and Scripting
Can you please point me in the correct direction?
I need a line or script to run though a given directory and find all files with "@domain.local" in there names and simple remove that.
For example if the files were named 1234@domain.local the file would then become 1234. (1 Reply)
Discussion started by: binary-ninja
1 Replies
7. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
8. Shell Programming and Scripting
Hello,
I have some data that looks like the following,
> <SALTDATA> (OVS0199262)
HCl
> <IDNUMBER> (OVS0199262)
OVS0199262
> <SUPPLIER> (OVS0199262)
TimTec
> <EMAIL> (OVS0199262)
info@timtec.net
> <WEBSITE> (OVS0199262)
http://www.timtec.net
I need to remove the data in... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
9. Shell Programming and Scripting
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Discussion started by: cozzin
9 Replies
10. Shell Programming and Scripting
Hi,
I know how to replace a string with another in a file.
But, i wish to replace the below string pattern
EncryptedPassword="{gafgfa}]\asffafsf312a" i.e EncryptedPassword="<any random string>"
To
EncryptedPassword=""
i.e remove the random password to a empty string.
Can you... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT DEBIAN
sagasu
sagasu(1) sagasu(1)
NAME
sagasu - GNOME tool to find strings in multiple files
SYNOPSIS
sagasu [string [dir]]
DESCRIPTION
sagasu is a GNOME tool to find strings in a set of files. The user specifies the search directory and the set of files to be searched.
Double-clicking on a search result launches a user command that can for example load the file in an editor at the appropriate line. The
search can recurse into subdirectories and can optionally ignore CVS directories.
Two optional command-line arguments can be given: the first is the initial search string and the second is the directory whose files will
be searched. If only one argument is given, it is taken as the search string. No search is actually started, but the appropriate fields
are initialized. Any subsequent arguments are ignored.
More documentation is available through the application's Help menu.
OPTIONS
--help display a help page and exit
--version
display version information and exit
LICENSE
This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no
warranty.
AUTHOR
Pierre Sarrazin
See the Sagasu Home Page:
http://sarrazip.com/dev/sagasu.html
BUGS
The files to be searches are still assumed to be in Latin-1, not in UTF-8. The same goes for the command-line arguments and the terminal
to which Sagasu is connected, if applicable.
HISTORY
Sagasu is a Japanese word that means "to search."
June 19th, 2010 sagasu(1)