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 DEBIAN
snarf
snarf(1) General Commands Manual snarf(1)NAME
snarf - Simple Non-interactive All-purpose Resource Fetcher
SYNOPSIS
snarf [-avqprzm] URL [outfile] ...
DESCRIPTION
Retrieves data from a variety of protocols, namely http, ftp, and gopher.
USAGE
snarf is invoked with any number of URLs and outfiles. If an outfile is not specified, snarf preserves the remote file name when saving.
For example, snarf http://foo.bar.com/images/face.gif will retrieve the file ``face.gif'' to the local system. In the event that there is
no filename (the url ends in a slash), the data is retrieved and stored in the file index.html for http URLs, ftpindex.txt for ftp URLs, or
gopherindex.txt for gopher URLs.
Using a dash, "-", as the outfile causes snarf to send its output to stdout rather than a file.
To log in to an ftp server or website that requires a username and password, use the syntax http://username:password@site.com/. If you omit
the password, you will be prompted for it.
Snarf has a built-in option to download the latest version of itself; simply run snarf LATEST.
OPTIONS
-a Causes snarf to use "active" ftp. By default, snarf uses passive ftp, and, if the server does not support it, falls back to active
ftp. Using the -a option will avoid the initial passive attempt.
-r Resumes an interrupted ftp or http transfer by checking if there is a local file with the same name as the remote file, and starting
the transfer at the end of the local file and continuing until finished. This option only works with HTTP servers that understand
HTTP/1.1 and ftp servers that support the REST command. snarf uses this option automatically if the outfile already exists.
-n Don't resume; ignore the outfile if it exists and re-transfer it in its entirety.
-q Don't print progress bars.
-p Forces printing of progress bars. Snarf has a compile-time option for whether progress bars print by default or not. The -p option
overrides the -q option. In addition, if progress bars are enabled by default, snarf suppresses them when standard output is not a
terminal. Using -p will override this behavior.
-v Prints all messages that come from the server to stderr.
-z Send a user-agent string similar to what Netscape Navigator 4.0 uses.
-m Send a user-agent string similar to what Microsoft Internet Explorer uses.
Each option only affects the URL that immediately follows it. To have an option affect all URLs that follow it, use an uppercase letter for
the option, e.g. -Q instead of -q.
ENVIRONMENT
Snarf checks several environment variables when deciding what to use for a proxy. It checks a service-specific variable first, then
SNARF_PROXY, then PROXY.
The service-specific variables are HTTP_PROXY, FTP_PROXY, and GOPHER_PROXY.
Snarf also checks the SNARF_HTTP_USER_AGENT environment variable and will use it when reporting its user-agent string to an HTTP server. In
the same spirit, it also uses the SNARF_HTTP_REFERER environment variable to spoof a Referer to the web server.
BUGS
Bugs? What bugs? If you find 'em, report 'em.
AUTHOR
Copyright (C) 2000 Zachary Beane (xach@xach.com)
17 Jun 2000 snarf(1)