I am trying to count number of record in a file and then append a trailer to that file.
Trailer should e in the format as below
T| <count of records>
count of records ---> this count should be one less than the actual count obtained, as the file will have a header.
Hi Unix team,
I have a file with 30 columns with tab delimited. I need to count the records based on column 18 & 21 data.
Hi,
I am trying to write a sh script which will give difference in given time to present time in months.
I get date from a script like
Code:
infoscript.sh | awk '{ print $3}'
where infoscript is a custom script and gives date in yyyy-mm-dd format
ex: 2010-04-12
Now, need to do something like this
Code:
awk '{ print $3}' | { get age in months so that if its more than 3 month
please solve my problem
i have a sample input file as
A
A
A
A
B
B
B
B
B
C
C
C
C
C
i want the output such that if the count of A or B or C is greater than 3
A
A
A
B
B
B
C
C
C
if the count of A is less than 3 i.e if the input file is like
A
A
B
B
B
B
C
C
C
then A should append B and the output file should be
A
A
B
B
B
B
C
C
C
the above output should repeat for both B and C too if the coun
Hi,
I have the code below as
Code:
cat <filename> | tr '~' '\n' | sed '/^$/ d' | sed "s/*/|/g" > <filename>
awk -F\| -vt=`date +%m%d%y%H%M%S%s` '$1=="ST",$1=="SE"{if($1=="ST"){close(f);f="214_edifile_"t"" ++i} ; $1=$1; print>f}' OFS=\| <filename>
This script replaces some characters and extracts the records
hi all,
i want the script for the following
my input is date mm-dd-yyyy
i.e 1-4-2012(it doesn't have zeros in the input ,in output it should append zeros and should print the output as defined below)
my output should be 2012-04-01(yyyy-dd-mm)
if my input is 11-14-2012
then my should be 2012-14-11
thanks in advance,
hemanth saikumar
Good evening
I need your help please, im new at Unix and i wanted to remove the first 5 headers for 100000 records files and then create a control file .ctl that contains the number of records and all seem to work out but when i tested at production it didnt wotk.
Here is the code:
Code:
#!
Hi,
I have 2 files as below
FILE1.dat
Code:
co1|co2|co3
abnd|45.56|AZ
dkny|30.2|PA
sam|.23|VA
FILE.CTL
Code:
FILENAME|FILE1.dat
NO OF RECORDS|3
CHECKSUM|75.99
Could you please help me to write a shell script to compare
1. TOTAL RECORDS from FILE1.dat with NO of RECORDS in FILE.CTL
2.
hello fellows,
I need help with a script, I'm using this one
Code:
HOSTS="192.168.10.9 192.168.10.15 "
SUBJECT="Attention - Gateway San Martin DOWN "
COUNT=1
EMAILID="lmail@mydomain.com"
for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')