Hi Friends
How do I do two things from one if statement inside awk? I want to run a script and create a new file from the same condition.
awk '{ if ($2 == ""){print " "|"cd /local/test; ./script.ksh"}{cat > ran_true.txt}}' $IN_FILE
Bolded are the two things I want to be done.
Thanks (1 Reply)
Having a little trouble with awk and an if statement. I have a test setup which I am trying to only print the records which start with the month 03. Everything I tried, prints everything, even the 02 month
03/23/2010 12:47:51
ga2828
SUBMITTED FROM URL: test123.cgi
show port count
... (2 Replies)
Hi,
I have a data file which contains record count.
So doing wc -l rightfit_balancing_count.dat | awk '{print $1}'] gives me the record count stored in the file.
Now, i want to send a mail from UNIX, if the record count is equal to 0,otherwise it should do nothing.
Any help... (2 Replies)
hi,
I have a l-column file of more than 10,000 lines with interspersed negative values. What I want to do is add a fixed number (360) everytime a negative value is encountered while leaving the positive ones as is. I need something that will read every line of the file and do the calculation... (3 Replies)
Hi
I have a file with
test test2 1000000657373
test1 test3 1000003849450
test2 test4 test5 100000837474
I cat the file and pipe it to an awk statement like so
cat /tmp/file |awk '{if ($3 ~ "^*$" && $3 > 1024000000) print "/vol/"$1"/"$2;else if ($4 ~ "^*$" && $4 > 1024000000) print... (15 Replies)
I am using awk as part of and if then else statement. I am trying to have the user enter a gene name and then a variant or variants and have a specific transcript assigned to the variants depending on the gene. Below is my code but the if then else statement is wrong. Basically, the gene name... (2 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
There has to be a way to do this with awk or maybe I'm just focusing on the wrong tool and making this harder than it needs to be.
I'm trying to do a file field lookup/join at a very large scale but the output changes has to change dramatically. I have an input file to do a field lookup from and... (3 Replies)
Discussion started by: brettcasper
3 Replies
LEARN ABOUT DEBIAN
shtool-path
SHTOOL-PATH.TMP(1) GNU Portable Shell Tool SHTOOL-PATH.TMP(1)NAME
shtool-path - GNU shtool command dealing with shell path variables
SYNOPSIS
shtool path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path path] str [str ...]
DESCRIPTION
This command deals with shell $PATH variables. It can find a program through one or more filenames given by one or more str arguments. It
prints the absolute filesystem path to the program displayed on "stdout" plus an exit code of 0 if it was really found.
OPTIONS
The following command line options are available.
-s, --suppress
Supress output. Useful to only test whether a program exists with the help of the return code.
-r, --reverse
Transform a forward path to a subdirectory into a reverse path.
-d, --dirname
Output the directory name of str.
-b, --basename
Output the base name of str.
-m, --magic
Enable advanced magic search for ""perl"" and ""cpp"".
-p, --path path
Search in path. Default is to search in $PATH.
EXAMPLE
# shell script
awk=`shtool path -p "${PATH}:." gawk nawk awk`
perl=`shtool path -m perl`
cpp=`shtool path -m cpp`
revpath=`shtool path -r path/to/subdir`
HISTORY
The GNU shtool path command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1998 for Apache. It was later taken
over into GNU shtool.
SEE ALSO shtool(1), which(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-PATH.TMP(1)