Search Results

Search: Posts Made By: EAGL€
8,906
Posted By RudiC
OK, how about awk -F"|" ' BEGIN {cfmt...
OK, how about awk -F"|" '
BEGIN {cfmt = "%-10s"
format = "\t%-10s\t%-20s\t%-14s\t%-14s\t%-32s\n"
UL = sprintf (cfmt format, _, _, _, _, _, _)
...
15,611
Posted By Yoda
I would suggest using SQL Loader to load the...
I would suggest using SQL Loader to load the content of your file into a temp table and use the temp table later for deletion:-
#!/bin/ksh

DB_CONN_STR=${user}/${password}@${dbinstance}

###...
15,611
Posted By RudiC
Why don't you do a non-destructive test run with...
Why don't you do a non-destructive test run with e.g. select?
5,351
Posted By Scrutinizer
Try: j=./abc/20141127 echo "${j#.}"
Try:
j=./abc/20141127
echo "${j#.}"
Forum: Solaris 05-26-2014
62,755
Posted By radoulov
In the output of vmstat the free memory is in KB,...
In the output of vmstat the free memory is in KB, the sar output is in pages.
bash-3.2$ sar -r 1 1

SunOS <name> 5.10 Generic_147440-09 sun4v 05/26/2014

14:23:00 freemem freeswap
14:23:01...
2,763
Posted By RudiC
I'm not sure either I understood your request...
I'm not sure either I understood your request correctly, nor am I convinced your awk will run fine. But, to output the relevant state's name, add this to your awk script and put file2 as first...
3,610
Posted By vgersh99
n=split($i,a,":") for field 0:29:0:0:0:0 results...
n=split($i,a,":") for field 0:29:0:0:0:0 results in

n=6 # 6 elements from string '0:29:0:0:0:0' separated by ':'
a[1]=0
a[2]=29
a[3]=0
a[4]=0
a[5]=0
a[6]=0
'j' is just a temporary iterator...
2,408
Posted By Corona688
It's just a somewhat oddly named variable. ...
It's just a somewhat oddly named variable.

Even more fun is when someone peppers an awk program with a variable Z or something, and never actually sets its value -- it's just a one-letter way to...
2,408
Posted By Yoda
As per manual: The name of a variable must be a...
As per manual: The name of a variable must be a sequence of letters, digits and underscores, but it may not begin with a digit. Case is significant in variable names.

So underscore is a valid...
2,408
Posted By Scrutinizer
It is like a letter. You can replace it with "A"...
It is like a letter. You can replace it with "A" for example. The array is called "_".
2,363
Posted By Scrutinizer
Actually I do not understand why $1==$1 &&...
Actually I do not understand why $1==$1 && $2==$2; is there. IMO it has no function and could just be left out.

--
This should be equivalent to the suggestion in post #2:
awk '{p=$NF; getline;...
3,257
Posted By pamu
awk -F \| 'NR==FNR{A[$0]++;next}{if(A[$1]){print...
awk -F \| 'NR==FNR{A[$0]++;next}{if(A[$1]){print $0","FILENAME}}' 2.txt 1.txt
3,257
Posted By Yoda
nawk -F\| 'NR==FNR{A[$1];next}$1 in A{print...
nawk -F\| 'NR==FNR{A[$1];next}$1 in A{print $0,FILENAME}' OFS=, 2.txt 1.txt
3,494
Posted By radoulov
Or use --re-interval, if you want to enable just...
Or use --re-interval, if you want to enable just that feature and if you don't want to disable all GNU awk extensions and those not allowed by POSIX.
3,494
Posted By Scrutinizer
Replace the * with a +. Try: awk -F\| '$1==1 &&...
Replace the * with a +. Try:
awk -F\| '$1==1 && $2==1 && $11~/\.[0-9][0-9][0-9]+/' infile "$file"
or
awk -F\| '$1==1 && $2==1 && $11~/\.[0-9]{3,}/' infile
The latter will not work with mawk and...
2,440
Posted By itkamaraj
$ awk -F\|...
$ awk -F\| '{for(i=1;i<=NF;i++)if($i~/DIAL|NOA/)printf(" %s %s|",i,$i)}{print ""}' input.txt
3 DIAL=415483420001| 13 NOA=international|


if you dont want the | as the last character then pipe...
2,440
Posted By balajesuri
perl -F'\|' -ane 'for($i=0;$i<@F;$i++){($F[$i] =~...
perl -F'\|' -ane 'for($i=0;$i<@F;$i++){($F[$i] =~ /DIAL|NOA/) && print $i+1,",$F[$i]|"}; print "\n"' inputfile
3,609
Posted By Scrutinizer
p="", i=0, m=0 "" != "CR124" {i=1,p="CR124"} ...
p="", i=0, m=0
"" != "CR124" {i=1,p="CR124"}
A[1]=A[1]"CR124 1320" FS} # result first time: A[1]="CR124 1320 "
2>0{m=2}
END {for(i=1,1<=1;i=2) print A[1]}

---------- Post updated at 14:49...
16,619
Posted By DGPickett
Or pull from target host as someone more...
Or pull from target host as someone more innocuous who can read just as well:
ssh -n someone@source 'cd head_dir ; find * | cpio -oaH crc | gzip -9' | (
cd head_dir2
gzcat | cpio -idmH crc
)
1,268
Posted By durden_tyler
"Dear" OP, It's unethical to ask for...
"Dear" OP,

It's unethical to ask for ready-to-go solutions in a forum of volunteers. You will have to learn to put in some effort in doing your homework before asking for help.

Since we are...
1,082
Posted By pravin27
something like this, sort -n inputfile |...
something like this,


sort -n inputfile | awk '{if (p != $1) {j=0}a[$1]=+$4;b[$1]=++j;p=$1} END {print "1st\t2nd\t3rd\t4th"; one=two=three=four=0;for (i in a) {if(b[i]==1){one++};if(b[i]==2)...
2,709
Posted By rdcwayx
awk -F, '{gsub(/f/,"",$1)}NR==1{a="91"...
awk -F, '{gsub(/f/,"",$1)}NR==1{a="91" $1;b[$1]++;next}!b[$1]++ {a=a ",91" $1}END{print a}' FILE
2,709
Posted By Scrutinizer
To drop the f force $1 into numerical context: ...
To drop the f force $1 into numerical context:
nawk -F, '{printf (NR>1?FS:x)91$1+0} END{print x}' infile
2,709
Posted By Chubler_XL
This should do it in 1 nawk command: nawk...
This should do it in 1 nawk command:

nawk -F, '{ printf (NR==1?"":",")$1} END {printf "\n"}' FILE
6,730
Posted By fubaya
Neither sort will work if you get more than 9...
Neither sort will work if you get more than 9 files unless the single digit numbers have a 0 before their number (01... 09, etc)

(examples)
# touch file{1,2,5,10,15,20}.log
# ls *.log| sort -u |...
Showing results 1 to 25 of 30

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