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
dvipos
DVIPOS(1) ConTeXt DVIPOS(1)
NAME
dvipos - compute positions in a DVI file
SYNOPSIS
dvipos [ OPTION... ] infile[.dvi]
DESCRIPTION
dvipos parses a DVI file looking for pos: specials. It currently recognizes pos:pxy, pos:pxywhd, pos:pxyplus, pos:begbox, pos:endbox,
pos:beglines, and pos:endlines. It then outputs the information from those specials along with information that only a DVI postprocessor
could determine, such as the current x and y location. The output looks like:
pospxywhd{text:54}{54}{10663sp}{8535sp}{21326sp}{34081sp}{0sp}
and is suitable for including in a tex(1) or pdftex(1) auxilliary file, such as document.tuo, to be read in by the next run of the tex(1)
or similar typesetting engine.
OPTIONS
-h, --help
print usage.
-W, --warning
print warnings.
-v, --verbose
print verbose output.
-d, --debug
print dvitype(1) debugging data.
-s, --smashchars
regard height and depth as zero.
-o, --output=FILE
send all output to FILE. Without this option, output goes to stdout.
-b, --bbox[=FILE]
send bounding box to FILE (default FILE is infile.pos).
-f, --framed[=BASE]
request copy of DVI file, BASE.dvi, with bounding boxes framed (default FILE is infile_frames.dvi). See the --framesize option.
-m, --mag=INT
override tex(1) magnification by INT.
-w, --framesize=INT
set frame rule size by INT (default 6554 = .1pt).
-p, --pages=X:Y
set page ranges from X to Y.
USAGE
dvipos is run mostly behind the scenes by ConTeXt's texexec(1) between runs of tex(1) or pdftex(1), in order to provide information to and
get information about positional graphics. These graphics are provided by the MetaFun interface to mpost(1). dvipos is not used (or
needed) in PDF-output mode but is needed for DVI-output mode. pdftex(1) starting with version 1.40 can produce position information even
in DVI mode, so once the ConTeXt macros take advantage of this feature, the need for dvipos will fade.
Until then, here is a typical use of dvipos:
dvipos notes.dvi
The position information that is output is collected by texexec(1) to include in the notes.tuo auxilliary file to use in the next run.
EXAMPLES
Extract positions from doc.dvi, with output to doc.loc:
dvipos -o doc.loc doc.dvi
Same as above, but also send bbox information to doc.pos:
dvipos -b -o doc.loc doc.dvi
Instead send bbox information to /tmp/debug.pos:
dvipos -b=/tmp/debug.pos -o doc.loc doc.dvi
SEE ALSO
dvips(1), dvitype(1), mpost(1), pdftex(1), tex(1), texexec(1).
For more about positional graphics, see the MetaFun documentation on the ConTeXt wiki <http://wiki.contextgarden.net/MetaFun>.
BUGS
If you specify a file for the -b option, you must join the option and name with = rather than (the more common) space:
dvipos -b=/tmp/debug.pos notes.dvi
works, but
dvipos -b /tmp/debug.pos notes.dvi
does not.
AUTHOR
dvipos is written by Jin-Hwan Cho <chofchof@ktug.or.kr>. It is free software (GPLv2 or later). This manpage was written by Sanjoy Mahajan
<sanjoy@mit.edu> and is in the public domain.
dvipos 20070107 (KPATHSEA) January 2007 DVIPOS(1)