Can somebody give me a cleaner way of writing the following script. I was thinking that I could use a loop in the awk statement. It works fine the way it is but I just want the script to be cleaner.
#!/usr/bin/sh
for r in 0 1 2 3 4 5 6
do
DAY=`gdate --date="${r} days ago" +%m\/%d\/%y`... (3 Replies)
I am having a problem with awk when I run it with a loop. It works perfectly when I echo a single line from the commandline. For example:
echo 'MFG009 9153852832' | awk '$2 ~ /^0-9]$/{print $2}'
The Awk command above will print field 2 if field 2 matches 10 digits, but when I run the loop... (5 Replies)
I am pretty new to this, but imagine what I am trying to do is possible
iI am trying to make an automated DB comparison tool that selects all columns in all tables and compares them to the same thing in another DB.
anyway I have created 2 files to help with this
the first file is a... (13 Replies)
Hi
I have a file which is having following text. The file is in a tabular form with 5 fields. i.e field1, field2 ..... field5 are its columns and there are many rows in it say COUNT is the number of rows
Field 1 Field2 Field3 Field4 Field5
------- ------- ... (8 Replies)
I'm trying to parse a configuration text file using awk. The following is a sample from the file I'm searching. I can retrieve the formula and recipe names easily but now I want to take it one step farther. In addition to the formula name, I would like to also get the value of the attribute... (6 Replies)
Hi all, I have a file containing 5000 rows and 4 columns. I need to do a loop within the rows based on the values of column 3. my sample data is formatted like the ones below: what i need to do is to make a loop that will allow me to plot the values of x,y,values corresponding to month 1 to month... (10 Replies)
I would like to loop over variables i and j consecutively,
{ a = -6.7
b = 7.0
c =0.1
{ for (i = 0; i<=(b-a)/c; i++)
for (j = 1; j<=(b-a)/c; j++)
'$1<=(a+j*c)&&$1>=(a+i*c)' FILENAME > output_j
'{print $2}' output_j > output_j_f
}
I essentially want to print the range of $1... (9 Replies)
Hi all,
please help me construct the command. i want to loop through all files named bam* and bed*. My awk works for a particular pair but there are too many pairs to do manually.
I have generated multiple files in a folder in a given pattern. The files are named like
bam_fixed1.bam... (2 Replies)
I have the data like this:
PONUMBER,SUPPLIER,LINEITEM,SPLITLINE,LINEAMOUNT,CURRENCY
IR5555,Supplier1,1,1,83.1,USD
IR5555,Supplier1,1,3,40.4,USD
IR5555,Supplier1,1,6,54.1,USD
IR5555,Supplier1,1,8,75.1,USD
IR5556,Supplier2,1,1,41.1,USD
IR5556,Supplier2,1,3,43.1,USD
... (3 Replies)
I am trying to parse a text file and send its output to another file but I am having trouble conceptualizing how I am supposed to do this in awk.
The text file has a organization like so:
Name
Date
Status
Location (city, state, zip fields)
Where each of these is on a separate line in... (1 Reply)
Discussion started by: kellyanneghj
1 Replies
LEARN ABOUT SUNOS
echo
echo(1B) SunOS/BSD Compatibility Package Commands echo(1B)NAME
echo - echo arguments to standard output
SYNOPSIS
/usr/ucb/echo [-n] [argument]
DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output.
echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi-
ronment variables.
For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows:
o echo your current-working-directory's full pathname
o pipe the output through tr to translate the path's embedded slash-characters into space-characters
o pipe that output through wc -w for a count of the names in your path.
example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w"
See tr(1) and wc(1) for their functionality.
The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if
the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape
characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's
echo() also understands a as the audible bell character; however, these commands do not have an -n option.
OPTIONS -n Do not add the NEWLINE to the output.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5)NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases.
SunOS 5.10 3 Aug 1994 echo(1B)