hi guys,
Suppose you have 100 files in a folder and you want to replace all occurances of a word say "ABCD" in those files with "DCBA", how would you do
it ???
jatin (13 Replies)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (2 Replies)
i have to search a string and replace with multiple lines.
example
Input
echo 'sample text'
echo 'college days'
output
echo 'sample text'
echo 'information on students'
echo 'emp number'
echo 'holidays'
i have to search a word college and replace the multiple lines
i have... (1 Reply)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (11 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
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)
I have a list of files all over a file system e.g.
/home/1/foo/bar.x
/www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g.
if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc.
There... (2 Replies)
Hello Guys,
I need to replace a string with multiple lines.
For eg:-
ABC,DEF,GHI,JKL,MNO,PQR,STU
need to convert the above as below:-
ABC,DEF,
GHI1
GHI2
GHI3,
JKL,MNO,
PQR1
PQR2
PQR3,
STU
i have tried using code as:- (2 Replies)
Discussion started by: jassi10781
2 Replies
LEARN ABOUT SUSE
prunehistory
PRUNEHISTORY(8) InterNetNews Documentation PRUNEHISTORY(8)NAME
prunehistory - Remove tokens from Usenet history file
SYNOPSIS
prunehistory [-p] [-f filename]
DESCRIPTION
prunehistory modifies a history(5)-format text file to "remove" a set of tokens from it. The tokens are removed by overwriting them with
spaces, so that the size and position of any following entries does not change. This has an effect similar to expiring the article, in
that it is still mentioned in the history database but cannot be retrieved.
prunehistory reads the standard input. The input is taken as a set of lines. Blank lines and lines starting with a number sign ("#") are
ignored. All other lines should consist of a message-ID followed by zero or more other fields (which are ignored). The message-ID is used
as the dbz(3) key to get an offset into the text file. Since innd only appends to the text file, prunehistory does not need to have any
interaction with it.
OPTIONS -p prunehistory will normally complain about lines that do not follow the correct format. If the -p flag is used, then the program will
silently print any invalid lines on its standard output. (Blank lines and comment lines are also passed through.)
This can be useful when prunehistory is used as a filter for other programs such as reap (a legacy program, probably no longer useful
with current versions of INN, but still available at <ftp://ftp.ruhr-uni-bochum.de/.subdisc1/local/jk.collection/>).
-f filename
The default name of the history file is pathdb/history; to specify a different name, use the -f flag.
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Converted to POD by Julien Elie.
$Id: prunehistory.pod 8592 2009-08-20 23:46:25Z eagle $
SEE ALSO dbz(3), history(5), innd(8).
INN 2.5.2 2009-09-11 PRUNEHISTORY(8)