Search Results

Search: Posts Made By: MIA651
1,402
Posted By nezabudka
Hi, It's wrong elif [ $bad_record_count <=...
Hi,
It's wrong
elif [ $bad_record_count <= $error_limit ];
expected
elif [ $bad_record_count -le $error_limit ];
and else
if [[ $chksanret = 0 ]]
expected
if [ $chksanret = 0 ]
or
if [...
4,449
Posted By vgersh99
modified code and the order of the files matters....
modified code and the order of the files matters.
awk '
{dep=substr($0,361,9)}
FNR==NR {
f1[$1]=dep
next
}
NF && (!($1 in f1) || f1[$1]==dep)' prod_last.dat prod.dat
4,449
Posted By vgersh99
there you go: awk ' {dep=substr($0,361,9)}...
there you go:

awk '
{dep=substr($0,361,9)}
FNR==NR {
f1[$1]=dep
next
}
NF && $1 in f1 && f1[$1]==dep' prod.dat prod_last.dat
4,449
Posted By vgersh99
put in a file and attach it to the thread. The...
put in a file and attach it to the thread.
The current implementation is based on you "mock-up" and might not be relevant at all to the issue at hand.
4,449
Posted By vgersh99
a bit of a longhand - making some assumptions...
a bit of a longhand - making some assumptions based on the file samples.....

awk -f mia.awk file1.txt file2.txt
where mia.awk is:

FNR==NR {
if (split($1,a, "_") ==3)
f1[$1]
next
}...
4,543
Posted By bakunin
In AIX the ps command itself has such a...
In AIX the ps command itself has such a provision: ps -T

On the other hand:
process_count=`ps -ef|grep $current_user|grep -v $current_process|grep -v $parent_process|grep -v grep|grep -v ps|grep...
2,373
Posted By vgersh99
s/SDV/STR/
s/SDV/STR/
813
Posted By Scrutinizer
There should be no space after the equal sign: ...
There should be no space after the equal sign:
HEADRREC="0012PVGRSCDVSDV 005 00000000000000000000 2014 0.00"
Try variable expansion to get the first field:
CUTVAR=${HEADRREC%% *}
813
Posted By vgersh99
CUTVAR=$(echo "$HEADERREC"|awk '{print...
CUTVAR=$(echo "$HEADERREC"|awk '{print $1}')
813
Posted By RudiC
Make it CUTVAR=$(echo "$HEADERREC"|awk '{print...
Make it CUTVAR=$(echo "$HEADERREC"|awk '{print $1}') (shell's command substitution)
6,063
Posted By Yoda
It should work then: $ cat script #!/bin/ksh ...
It should work then:
$ cat script
#!/bin/ksh

DIV=$1

if [[ "$DIV" = @(ter|bom|hre|nte|mol) ]]
then
echo "something"
else
echo "Please enter a correct division"
fi

Output:
$ ./script...
1,535
Posted By MadeInGermany
>> test.log 2>&1 to also redirect...
>> test.log 2>&1 to also redirect stderr.
1,535
Posted By Yoda
You can use group command...
You can use group command (http://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html#Command-Grouping) { ...; } and append output to file:
{ command 1; command 2; command 3; } >>...
11,557
Posted By hanson44
You might try sed book "Definitive Guide to sed":...
You might try sed book "Definitive Guide to sed": sed book - Definitive Guide to sed (http://www.sed-book.com/)
7,145
Posted By Scrutinizer
This would break if there are file names with...
This would break if there are file names with spaces and/or special characters. To avoid that you would need to use properly quoting:
print "$FILE"
tail -1 "$FILE"

Also, wc -c only counts bytes,...
7,145
Posted By Scrutinizer
Try: find sent/ -type f -exec tail -1 {} \; |...
Try:
find sent/ -type f -exec tail -1 {} \; | awk '{print length}'
To also count the linefeed at the end of the line, like wc -c or wc -m use awk '{print length+1}'



--
Use wc -c counts...
7,145
Posted By in2nix4life
Using awk in the find command: find sent/...
Using awk in the find command:


find sent/ -type f -exec awk 'END{printf("%d\t%s\n",length($0),FILENAME)}' {} \;


Prints out number of characters and then the filename.
7,145
Posted By birei
Hi MIA651, One way using perl. It prints the...
Hi MIA651,

One way using perl. It prints the file name, a colon and the number of characters in last line:
$ perl -lne 'if ( eof ) { printf qq|%s: %d\n|, $ARGV, length; }' *
3.txt: 12
AAAB.txt:...
7,145
Posted By Yoda
Why don't you use a loop:- for file in sent/* ...
Why don't you use a loop:-
for file in sent/*
do
tail -1 $file | wc -c
done
OR
for file in $( find sent/ -type f )
do
tail -1 $file | wc -c
done
OR you can write a script which will...
10,643
Posted By alister
That can do the job if your AWK implementation...
That can do the job if your AWK implementation treats a multicharacter RS as a regular expression and if you set RS to a regular expression which mimicks the default value of FS. In effect, what is...
10,643
Posted By RudiC
Try awk '{for (i=1;i<=NF;i++) if (length($i)>max)...
Try awk '{for (i=1;i<=NF;i++) if (length($i)>max) max=length($i)} END{print max}' file
2,144
Posted By Yoda
You can use awk with substr funtion. ...
You can use awk with substr funtion.

Syntax:-

awk ' { print substr(string, start, length) } '
3,010
Posted By Don Cragun
When setting a shell variable you can't have...
When setting a shell variable you can't have spaces around the "=". You can in awk; but not in shell.
2,698
Posted By vgersh99
awk -v OFS=, 'NR>4{exit}{gsub("-"," -");print...
awk -v OFS=, 'NR>4{exit}{gsub("-"," -");print $1,$2,$3+0,$4+0}' OFMT='%.2f' input
2,698
Posted By itkamaraj
try this... (with some assumption) awk -v...
try this... (with some assumption)

awk -v OFS=, 'NR>5{exit}{gsub("-"," -");print $1,$2,$3,$4}' xtr3.rpl
Showing results 1 to 25 of 26

 
All times are GMT -4. The time now is 04:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy