03-15-2005
would like to do with shell and not perl..
Quote:
what is your desired output looks like ??
I want to substitue the word "hai" with "power hai" in all the files and files in all the subfolders..recursively.
But there are words like $hai which i want to keep it as it is..since it defined as a variable..
Please help
Esham
10 More Discussions You Might Find Interesting
1. Linux
we hv a big enviroment networked.
we use squid proxy.
access allowed by src address previously.
we have win2000 network with ads.
my requirement is the proxy should allow domain users only for access.
how can i map my windows userdatabase with squid
is there any thing specific which has 2 b... (1 Reply)
Discussion started by: sriram.s
1 Replies
2. UNIX for Dummies Questions & Answers
Hi, I'm a newbie.
I need help on my first assignment in UNIX.
1. How do I determine the number of non-empty directories?
I was told to create a variable ARCHIVE, which points to the directory that contains the archive of the messages. But I'm so dumb and I don't even know how to do this.
2. In... (1 Reply)
Discussion started by: hygsg
1 Replies
3. UNIX for Dummies Questions & Answers
Hi every one
I have got very very bad Email, My question is:
How can I get all information about that f*** Email, I do mean
IP,reall name, Adress, user name, password etc... I wonder if there is any program or website that I can see that email, help me please
When I used windows Xp(old... (2 Replies)
Discussion started by: Cano
2 Replies
4. UNIX for Dummies Questions & Answers
Hi...
Why should I press F1 to start windows?! I have Xp in my computer... thx 4 help
Cano (1 Reply)
Discussion started by: Cano
1 Replies
5. Shell Programming and Scripting
I have a list of variables: ss1, ss5, ss6, ss8, st2 etc. (these values are not fixed, configurable). Now, I have assigned ss5=”test”. And I want to search in the list for the string “test” to know which variable is having the value “test”. Can u pls tell me how to do this? (10 Replies)
Discussion started by: kanchan_cp
10 Replies
6. Shell Programming and Scripting
Hi Folks,
I am new to this forum. and I just started learning shell scripting. I have a file called energy.out which looks like:
-218213.3729
-224215.0059
-221509.3651
-221094.2627
-220660.3223
-222630.2339
-218697.8693
Now I want to calculate the average of energies and then average... (3 Replies)
Discussion started by: pkar
3 Replies
7. Shell Programming and Scripting
When i run this command, everything is ok. The file can be email and attached but soon after i download the file, the file cant be read. It's seem corrupted. Totally cant be read although i'm using context or wordfile. Original file generated at ek_bkup/alert/tbspace_datafile.log is OK.....
... (7 Replies)
Discussion started by: adzuanamir
7 Replies
8. UNIX for Dummies Questions & Answers
I have this code:
#!/bin/sh
awk 'BEGIN
NR == 2
repl = "PHI"
$4 = repl
print $0 'dryloop.txt
and this code:
#!/bin/sh
sed -e '1s/\|$/\|COMID\|/g' -e 's/^087.*$/&PHI\|g' hl.dsldryloop > textdry.txt
My code won't work. I want to change the COMID of lines starting with 087 .
this is my... (15 Replies)
Discussion started by: arkhei
15 Replies
9. Homework & Coursework Questions
How to find the ten most common words in a file (1 Reply)
Discussion started by: jass
1 Replies
10. Shell Programming and Scripting
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies
LEARN ABOUT DEBIAN
shell-quote
SHELL-QUOTE(1p) User Contributed Perl Documentation SHELL-QUOTE(1p)
NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS
--debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)