10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Question: Write a command to print the fields in a text file in reverse order?
awk 'BEGIN {ORS=""} { for(i=NF;i>0;i--) print $i," "; print "\n"}' filename
I was thinking it should be (what is the need to set ORS="" ? )-
awk 'BEGIN { for(i=NF;i>0;i--) print $i," "; print "\n"}' filename (3 Replies)
Discussion started by: Tanu
3 Replies
2. Shell Programming and Scripting
Hello Team,
here is the code:
scripts]# ls /etc/init.d/ | awk 'BEGIN{ORS=" && "} /was.init/ && !/interdependentwas/ && !/NodeAgent/ && !/dmgr/{print "\$\{service_cmd\} "$0 " status"}' 2>/dev/null
${service_cmd} cmserver_was.init status && ${service_cmd} fmserver_was.init status &&... (6 Replies)
Discussion started by: chandana.hs
6 Replies
3. UNIX for Dummies Questions & Answers
Hi all...
In the OSX forum I am starting a new awk project to learn awk.
In this code snippet I have had to check boundaries to ensure that no NUMERICAL error occurs in the rest of the code...
printf "Enter frequency required:- ";
getline FREQ;
RATE=(BYTES*FREQ);
if ( RATE <= 4000 ) {... (4 Replies)
Discussion started by: wisecracker
4 Replies
4. Shell Programming and Scripting
Good evening, Im newbie at unix specially with awk
From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example
1.
This is the inputfile:
$ more MapaRep.txt
ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies
5. Shell Programming and Scripting
Hi Team,
I have .csv file in the following format
.csv file
TAB1;COL1;DATATYPE;NOTNULL;WITH DEFAULT
TAB2;COL1;DATATYPE;NOTNULL;WITH DEFAULT
....
....
....
output:
ALTER TABLE TAB1. add COL1 DATATYPE NOTNULL WITH DEFAULT;
ALTER TABLE TAB2 add COL1 DATATYPE NOTNULL WITH DEFAULT;
I... (5 Replies)
Discussion started by: rocking77
5 Replies
6. Shell Programming and Scripting
Hello all,
Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val:
> cat getnon0file.sh
#!/bin/bash
this="getnon0file.sh"
USAGE=$this"
InFile="xyz.38"
Min="0.05"
#
awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies
7. Shell Programming and Scripting
typeset -i i=1
while read -r filename; do
Splitfile=`$Targetfile_$i.txt`
awk 'substr($0,1,5) == substr($filename,1,5) && substr($0,526,2) == substr($filename,6,2) && substr($0,750,12) == substr($filename,8,12)' $SourceFilename >> $Splitfile
i=i+1
done < /tmp/list.out
I am using this logic... (1 Reply)
Discussion started by: pukars4u
1 Replies
8. UNIX for Dummies Questions & Answers
hi there
i write one awk script file in shell programing
the code is related to dd/mm/yy to month, day year format
but i get an error
please can anybody help me out in this problem ??????
i give my code here including error
awk `
# date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies
9. Shell Programming and Scripting
var1=`echo "emp,dept,salgrade" | awk -F, '{print NF}'`
count=1
while ;
do
i=`expr $count`
tname=`echo "emp,dept,salgrade" | awk -F, '{ print $(echo $i) }'`
count=$count+1;
echo ${tname};
echo $count
done
I want to store in tname=emp, tname=dept,tname=salgrade
I am getting... (2 Replies)
Discussion started by: dreams5617
2 Replies
10. Shell Programming and Scripting
:D dear members I have a good knowledge of gawk and seem to do quite well with it.. but I have never understood what the use of the rs and ors are for or how they are used.. i am thinking they are for seperating lines and paragraphs but i have absolutely no idea how to make it work, if that is what... (2 Replies)
Discussion started by: moxxx68
2 Replies