11-02-2010
ok so I modified my shell script like this:
-------------------------------------------
#!/usr/bin/sh
#---------------------------------------------------------------------
# Program ....... dups_filter.sh
pos="$1"
filename="$2"
awk -v key="$pos" -v infile="$filename" '{FS="";split($NF,a,"_"); site=a[3];keysite=key "_" site;
if (b[keysite]<=a[4]a[5]) {b[keysite]=a[4]a[5];c[keysite]=$0;}}
END{for (i in b) print c[i]}' infile
#end of .sh program
---------------------------------------------------------------
I have the .sh script in the same directory as the infile dups.txt.
I execute from the command line like:
./rem_dups.sh 1 dups.txt > no_dups.txt
and I get the error
awk: Cannot find or open file infile.
The source line number is 3.
Could somebody help me with this confusion?
Last edited by script_op2a; 11-02-2010 at 06:33 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have a shell script with an ambedded awk script.
i need to pass a script variable to the awk script.
Please help.
Thanks in advance
Himani (3 Replies)
Discussion started by: HIMANI
3 Replies
2. UNIX for Dummies Questions & Answers
Hey Guys
from the below script what I understood is we are sending the the first parameter as input to the main (){} file
main > $LOGFILE 2>&1
but can we send two or three parameter as input to this main file as
main > $LOGFILE 2>&1 2>&2 like this
Can any one plz help I need to writ a... (0 Replies)
Discussion started by: pinky
0 Replies
3. Shell Programming and Scripting
Hello experts,
can I return a value from gawk to a shell script ?
My script as follows,
#Here I want the num value to shell script so that I can use later
gawk '
{
split($0,num,",");
print num
}'
gawk -v no=$number '{print no}'
file1
... (3 Replies)
Discussion started by: user_prady
3 Replies
4. Shell Programming and Scripting
Hello Experts,
Actually I was searching for a solution here in this forum , but didn't get what exactly I want . Is this possible to do in awk ?
I am trying to do some thing like below in ksh script . Upto my knowledge I can pass shell script to awk with "-v " option.
But I... (3 Replies)
Discussion started by: user_prady
3 Replies
5. Shell Programming and Scripting
I have a working and tested AWK script that removes duplicates from an input file and generates an output file without the duplicates.
I had help from my other post to develop it:
... (3 Replies)
Discussion started by: script_op2a
3 Replies
6. Shell Programming and Scripting
Hi,
I basically have 2 shell scripts.
One is a shell script will get the variable value from the user. The variable is nothing but the IP of the remote system.
Another shell script is a script that does the job of connecting to the remote system using ssh. This uses a expect utility in turn.
... (2 Replies)
Discussion started by: sunrexstar
2 Replies
7. Shell Programming and Scripting
Why does this work
for myfile in `find . -name "R*VER" -mtime +1`
do
SHELLVAR=`grep ^err $myfile || echo "No error"`
ECHO $SHELLVAR
done
and outputs
No error
err ->BIST Login Fail 3922 err
No error
err ->IR Remote Key 1 3310 err
But... (2 Replies)
Discussion started by: alan
2 Replies
8. Post Here to Contact Site Administrators and Moderators
Variable I have in my shell script
diff=$1$2.diff
id=$2
new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new
I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies
9. Shell Programming and Scripting
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
10. Shell Programming and Scripting
Hi,
Please need to print the Rej variable outsite the awk script which is given below...please advised how to achieve it.
#!/bin/bash
echo "Enter DMU Pipe delimited File name for the Feed to be validated"
read DMU_File
echo "Enter Pre-DMU File name for the Feed"
read Predum_file
... (3 Replies)
Discussion started by: pelethangjam
3 Replies
LEARN ABOUT DEBIAN
lsh-decrypt-key
LSH-DECRYPT-KEY(1) Lsh Manuals LSH-DECRYPT-KEY(1)
NAME
lsh-decrypt-key - Decrypts the given key and outputs it in unecrypted form.
SYNOPSIS
lsh-decrypt-key [OPTION...]
DESCRIPTION
CAUTION! The information in this manpage may be invalid or outdated. For authorative information on lsh, please see it's Texinfo manual
(see the SEE ALSO section).
The given key (supplied on stdin or in the file given with the --in option) and it's passphrase is read. The key is decrypted and written
to stdout (or the file supplied by the --out option).
This program is usually invoked by the lsh-upgrade-key script.
OPTIONS
--askpass=Program
Program to use for reading passwords. Should be an absolute filename.
--in=encrypted key filename
(defaults to stdin)
--out=decrypted key filename
(defaults to stdout)
--debug
Print huge amounts of debug information
--log-file=File name
Append messages to this file.
-q, --quiet
Suppress all warnings and diagnostic messages
--trace
Detailed trace
-v, --verbose
Verbose diagnostic messages
-?, --help
Give this help list
--usage
Give a short usage message
-V, --version
Print program version
DIAGNOSTICS
See the --verbose , --trace and --debug options.
REPORTING BUGS
Report bugs to <bug-lsh@gnu.org>.
COPYING
The lsh suite of programs is distributed under the GNU General Public License; see the COPYING and AUTHORS files in the source distribution
for details.
AUTHOR
The lsh program suite is written mainly by Niels Moller <nisse@lysator.liu.se>.
This man-page was written for lsh 2.0 by Pontus Freyhult <pont_lsh@soua.net>, it is based on a template written by J.H.M. Dassen (Ray)
<jdassen@wi.LeidenUniv.nl>.
SEE ALSO
DSA(5), lsh(1), lsh-authorize(1), lsh-decode-key(1), lsh-export-key(1), lsh-keygen(1), lsh-make-seed(1), lsh-upgrade(1), lsh-upgrade-
key(1), lsh-writekey(1), lshd(8), secsh(5), SHA(5), SPKI(5), ssh-conv(1)
The full documentation for lsh is maintained as a Texinfo manual. If the info and lsh programs are properly installed at your site, the
command
info lsh
should give you access to the complete manual.
LSH-DECRYPT-KEY NOVEMBER 2004 LSH-DECRYPT-KEY(1)