9 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Dear experts,
I am a relative novice in the Unix and came across a very useful code that I regularly use for my research blindly. I am wondering if any of the professional members could kindly briefly explain to me what the code actually does?
Many thanks in advance
The script is
awk... (4 Replies)
Discussion started by: arsalane
4 Replies
2. Shell Programming and Scripting
the following code works perfectly for me:
# AWK 1
gawk -F, '/,'${ThisMonthDOW}' '${ThisMonthMON}' :: '${ThisMonthYEA}',/ {
if (NF == 10)
... (6 Replies)
Discussion started by: SkySmart
6 Replies
3. Shell Programming and Scripting
can someone please help me spot and fix the issue with the following code:
awk -F, -v SEARCHPATT="(Wed|Tue)" -v ADDISTR="Mon|Tue|Wed|Thu|Fri|Sat|Sun" -vVF="$VALFOUND"
"BEGIN{ {D = D = 1
D = D = 2
}
$0 ~ "," VF "," {L = 1 ... (9 Replies)
Discussion started by: SkySmart
9 Replies
4. Shell Programming and Scripting
sample data.file:
0,mfrh_green_screen,1454687485,383934,/PROD/G/cicsmrch/sys/unikixmain.log,37M,mfrh_green_screen,28961345,0,382962--383934
0,mfrh_green_screen,1454687785,386190,/PROD/G/cicsmrch/sys/unikixmain.log,37M,mfrh_green_screen,29139568,0,383934--386190... (7 Replies)
Discussion started by: SkySmart
7 Replies
5. Shell Programming and Scripting
Hi,
I have a colon-separated file which contains names of users, among other details. My aim is to extract the line with the name and assign the name to a variable. A sample file is as follows --
ID: 123456
DEPARTMENT: xyz
NAME: Bar, Foo
Considering the Tabs between the colon and the... (6 Replies)
Discussion started by: Subu1987
6 Replies
6. Shell Programming and Scripting
#!/bin/ksh
set -x
FILENAME=$1
#To calculate debit and credit
DEBIT=`awk -F, '{value=$28 ;if(value<0) {debit+=value}} END {print debit}' $FILENAME`
CREDIT=`awk -F, '{value=$28 ;if(value>0) {credit+=value}} END {print credit}' $FILENAME`
#This part is not working since the debit value is... (2 Replies)
Discussion started by: selvankj
2 Replies
7. Shell Programming and Scripting
Hi Guys,
Can someone please explain this code to me. I could figure out it's adding and comparing two fields but I am not sure which ones.
sort -t"|" -k3.1 /tmp/mpcashqc.xtr| awk -F"|" '{CHECKAMT+=$3;BATCHTOT=$4;\
items++}END{for(i in CHECKAMT) if (CHECKAMT!=BATCHTOT)... (6 Replies)
Discussion started by: nua7
6 Replies
8. UNIX for Dummies Questions & Answers
Hi Folks,
I know my code works, but I'm still a newbie at arrays and how they function.
Is there is shorter way to write my code? I'm taking averages in multiple files and concatenating output into 1 file.
TIA!
for file in *;
do
awk -F"\t" '{a1+=$1}{a2+=$2}{a3+=$3} {a4+=$4}{a5+=$5}... (1 Reply)
Discussion started by: calitiggr
1 Replies
9. Shell Programming and Scripting
{ # print NF,NR,$0;
if ( ($(NF-1) != 0) && ($NF != 0) )
{if ($(NF-1) > $NF)
{percent=$(NF-1)/$NF-1;}
else
{percent=$NF/$(NF-1)-1;}
}
printf "%8.4f\%\n",percent*100;
if (percent > 0.05||percent < -0.05 ){exit 1;}
}'
Use code tags please, ty. Also try to use a more... (1 Reply)
Discussion started by: bosmat shani
1 Replies