05-30-2012
File operations are failing inside the script
Hi,
does any one know the environmental parameter that I have to set so as to make sure the file operations run properly within the script.
right now when I am doing a cat from within the script nothing happens, same is the case when I do a grep. when I am doing awk '{print $0 }' its printing the script name like the shell variable instead of the awk variable.
any idea\suggestion?
thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have to find out the file system location of the script file inside script. for example a script "abc.sh" placed anywhere in the file system when executed shold tell by itself the location of it.
example
#pwd
/
#./abc
this is /
#cd /root
#./abc
this is /root
#cd /
#/root/abc
this... (10 Replies)
Discussion started by: asami
10 Replies
2. Shell Programming and Scripting
Hi,
How can I create a file inside a script. The thing is that, I have to create the file inside the script and it will be acting as a log file the script.Whenever I execute the script the file has to be created and the output has to be directed into that file.
Tahnks in advance (11 Replies)
Discussion started by: sendhilmani
11 Replies
3. Shell Programming and Scripting
Hi,
I want to compare two files. Files will look like as follows:
file1:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890
file2:
ZXCVBVNM|0987654321234567
POLKIJUYH|1234789060985478
output file should be:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890
Thnaks in advance (6 Replies)
Discussion started by: nivas
6 Replies
4. Shell Programming and Scripting
When my script deals with large input files like 22Gb or 18 GB the basic commands like sort or join fails when run from inside the shell scripts. Can there be any specific reason for this?
For e.g.
sort -u -t "," -k1,1 a.csv > a.csv.uniq"
sort -u -t "," -k1,1 b.csv > b.csv.uniq"
The... (3 Replies)
Discussion started by: esha
3 Replies
5. Shell Programming and Scripting
Friends,
I have a file with contents like:
interface Serial0/4/0/0/1/1/1/1:0
encapsulation mfr
multilink
group 101
Now I need to manipulate the file in such a way that to all the numbers less than 163, 63 gets added and to all numbers greater than 163, 63 gets deducted.(The numbers... (2 Replies)
Discussion started by: shrijith1
2 Replies
6. Shell Programming and Scripting
Hi,
i have written a shell script and its working fine till now. Now, i have to enhance it with a small updation.
i need to make a file inside my file that will contain the below parameters
1) Customer_id
2) Server_id
3) No. Account
All the above variables are already been taken in... (3 Replies)
Discussion started by: dazdseg
3 Replies
7. Shell Programming and Scripting
I'm using the following script to check cisco router health and I'd like to save output to a file,
vty_runcmd.sh > /check/check-cisco-health
script works and output is saved to a file. However using it in crontab file is created but output is not printed inside it. In crontab,
*/5 * * * *... (4 Replies)
Discussion started by: marmellata
4 Replies
8. Shell Programming and Scripting
I am struck up with a problem and that is with output redirection.
I used all the ways for the redirection of the output of c binary to a file, still it is failing.
Here are the different ways which I have used:
./a.out | tee -a /root/tmp.txt 2>&1
./a.out | tee -a /root/tmp.txt 1>&1
./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies
9. Shell Programming and Scripting
I have a following script to evaluate if file exist in the directory and then archive it.
#!/bin/bash
#master directory
scriptdir="/flex/sh/interfaces" #change this path only - all other paths are connected with it
filedir="/flex/interfaces" #change this path only - all other paths are... (3 Replies)
Discussion started by: viallos
3 Replies
10. Shell Programming and Scripting
Hi all,
i need to do a piecewise integration between this example data inside a file :
500856704.00 11536282.5600897 50496
500402784.00 11538000.3654401 -453920
500654880.00 11538000.4662785 252096
500604416.00 11539718.4330113 -50464
500907168.00 11539718.5541121 302752
500705280.00... (3 Replies)
Discussion started by: Board27
3 Replies
LEARN ABOUT POSIX
scriptreplay
SCRIPTREPLAY(1) User Commands SCRIPTREPLAY(1)
NAME
scriptreplay - play back typescripts, using timing information
SYNOPSIS
scriptreplay [options] [-t] timingfile [typescript [divisor]]
DESCRIPTION
This program replays a typescript, using timing information to ensure that output happens in the same rhythm as it originally appeared when
the script was recorded.
The replay simply displays the information again; the programs that were run when the typescript was being recorded are not run again.
Since the same information is simply being displayed, scriptreplay is only guaranteed to work properly if run on the same type of terminal
the typescript was recorded on. Otherwise, any escape characters in the typescript may be interpreted differently by the terminal to which
scriptreplay is sending its output.
The timing information is what script(1) outputs to standard error if it is run with the -t parameter.
By default, the typescript to display is assumed to be named typescript, but other filenames may be specified, as the second parameter or
with option -s.
If the third parameter is specified, it is used as a speed-up multiplier. For example, a speed-up of 2 makes scriptreplay go twice as
fast, and a speed-up of 0.1 makes it go ten times slower than the original session.
OPTIONS
The first three options will override old-style arguments.
-t, --timing file
File containing script's timing output.
-s, --typescript file
File containing script's terminal output.
-d, --divisor number
Speed up the replay displaying this number of times. The argument is a floating point number. It's called divisor because it
divides the timings by this factor.
-m, --maxdelay number
Set the maximum delay between transcript updates to number of seconds. The argument is a floating point number. This can be used
to avoid long pauses in the transcript replay.
-V, --version
Display version information and exit.
-h, --help
Display help text and exit.
EXAMPLE
% script --timing=file.tm script.out
Script started, file is script.out
% ls
<etc, etc>
% exit
Script done, file is script.out
% scriptreplay --timing file.tm --typescript script.out
SEE ALSO
script(1)
COPYRIGHT
Copyright (C) 2008 James Youngman
Copyright (C) 2008 Karel Zak
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
Released under the GNU General Public License version 2 or later.
AUTHOR
The original scriptreplay program was written by Joey Hess <joey@kitenet.net>. The program was re-written in C by James Youngman <jay@
gnu.org> and Karel Zak <kzak@redhat.com>.
AVAILABILITY
The scriptreplay command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux
/utils/util-linux/>.
util-linux September 2011 SCRIPTREPLAY(1)