Search Results

Search: Posts Made By: greet_sed
1,503
Posted By Don Cragun
I don't see that greet_sed's suggestion makes any...
I don't see that greet_sed's suggestion makes any attempt to extract just the last component of any of the pathnames in your two files. You didn't show us how your tar archives are created and you...
13,093
Posted By stomp
c00l That works too: xmllint file.xml...
c00l

That works too:

xmllint file.xml --xpath '//PORTED_NUM/text()'It was there even without installing as it is part of the basic libxml2-utils package here. It too seems that xmllint has a...
2,315
Posted By MadeInGermany
While the sed hack can be generalized for Unix ...
While the sed hack can be generalized for Unix
sed -e 's/'\'\''/'\''\
'\''/g'
it is actually not needed:
x=""; while IFS=. read a b
do
if [ "$x" != "$a" ]; then
printf...
2,002
Posted By RavinderSingh13
Hello Arnaush78, Could you please go through...
Hello Arnaush78,

Could you please go through the following and let me know if this helps you.

TARGET=$(awk -F "PATH: " -vx=$IP ' $0 ~ x {print $2}' config_ip.cfg)
awk -F "PATH: " #### -F in...
2,315
Posted By RudiC
Try also awk -F. -vFMT="'%s'" '$1 != LAST...
Try also
awk -F. -vFMT="'%s'" '$1 != LAST {printf QRS FMT, $1; QRS = ORS; LAST = $1} {printf "," FMT, $2} END {printf ORS}' file
'AAA_POC_DB','TAB1','TAB2','TAB3','TAB4'
'BBB_POC_DB','TAB1','TAB2'...
2,315
Posted By RavinderSingh13
Hello raju2016, Could you please try...
Hello raju2016,

Could you please try following and let me know if this helps you.

awk -F"." -vs1="'" 'FNR==NR{A[$1]=A[$1]?A[$1] OFS s1 $NF s1:s1 $NF s1;next} A[$1]{print s1 $1 s1 OFS...
3,952
Posted By RudiC
The output is redirected to the respective file,...
The output is redirected to the respective file, controlled by $5, as requested in post#1. If a new (i.e. not yet registered) $5 shows up in a line, the new file name is constructed in FN[$5], and...
2,018
Posted By Aia
Save as jiam912.pl Run as perl jiam912.pl input...
Save as jiam912.pl
Run as perl jiam912.pl input

#!/usr/bin/perl
use strict;
use warnings;

my @id;
my %data;
my $set = 0;

while(<>) {
unless (/^\d/) { ++$set; next }
my ($id,...
2,047
Posted By RudiC
p will be set to 2 if the line matching any...
p will be set to 2 if the line matching any pattern begins with <?xml..., or 1 otherwise. When printing it is counted down until it reaches 0, thus printing 2 or 1 line, resp.
The n = 2 doesn't...
2,024
Posted By RudiC
With a recent shell: while read -a VARR; do for...
With a recent shell:
while read -a VARR; do for i in ${!VARR[@]}; do echo -n "var$i:${VARR[$i]} "; done; echo; done < file3
var0:AA var1:FG var2:TH
var0:AD var1:FR var2:HK var3:LO
var0:AX...
955
Posted By RudiC
How about iconv -futf8 -tascii//translit file ...
How about
iconv -futf8 -tascii//translit file
Ex: "C" should be replaced as "C"
"O" should be replaced as "O"
9,399
Posted By RudiC
I assume you are using ksh, because in other...
I assume you are using ksh, because in other shells (e.g. bash), piped commands are executed in subshells whose variables are not conveyed back to the parent, so $AMT would not be defined. On top,...
1,738
Posted By disedorgue
Hi greet_sed, ${b//,/ } is just to pass $b...
Hi greet_sed,
${b//,/ } is just to pass $b several arguments to printf...
Under bash (explanation in red):
$ help printf
printf: printf [-v var] format [arguments]
Formats and prints...
1,832
Posted By RudiC
This works well on the sample given. But, the...
This works well on the sample given. But, the specification doesn't say that
- the two patterns follow in the next TWO consecutive lines
- the order of the patterns is given

Should the be more...
2,319
Posted By Don Cragun
Hi wahi80, Assuming that...
Hi wahi80,
Assuming that /mapr/datalake/optum/optuminsight/onepay_dev/fs_dev/raw/pklist/op/part-m-00000 is an empty file, and desc.txt and pk.txt contain the sample input shown in post #1 in this...
2,319
Posted By Chubler_XL
Not sure about the contents of the part-m-00000...
Not sure about the contents of the part-m-00000 file but this should do the trick:

awk -F "[ |]*" '
FNR==NR{T[$1"."$2]=$3; next}
FNR>1{
printf $1 "|" $2 "|"
flds=split($2, F, ",")
...
2,466
Posted By Scrutinizer
Hi Don, that does not seem to be an accurate...
Hi Don, that does not seem to be an accurate statement.

The $ is still required for variable expansions within double bracket expressions (as well as within single brackets (test commands); a...
2,466
Posted By Don Cragun
Taking your first .txt file as an example, let us...
Taking your first .txt file as an example, let us see what your code is doing (remember that set -xv is your friend when trying to debug a shell script).

The for loop sets file to:...
4,778
Posted By Corona688
You can do that with proper error checking. It's...
You can do that with proper error checking. It's a part of programming, the script can't do it for you.

die() {
echo "$@" >&2
exit 1
}

find ... || die "find did not work"
...
1,641
Posted By RudiC
Using your NEW example input file - not the one...
Using your NEW example input file - not the one from post#1 - and the explanation you gave in post #7, the awk script
awk -F\| '!$5 {$5 = (LAST13 == $1 FS $3)?LAST4:"CONST"} 1; {LAST13 = $1 FS $3;...
2,380
Posted By RudiC
echo "mypassword" | base64 ...
echo "mypassword" | base64
bXlwYXNzd29yZAo=
3,290
Posted By Don Cragun
Hi greet_sed, That is close, but there is an...
Hi greet_sed,
That is close, but there is an extra %s in your printf format string. Since there is only one operand to be formatted, only one %s is needed:
A=1234;
B=Welcome
printf "%s\n"...
3,950
Posted By RavinderSingh13
Hello Jagadeesh kumar, Could you please try...
Hello Jagadeesh kumar,

Could you please try following and let me know if this helps you.

awk '{$1=="unix"?++A[$1]:A[$1]} A[$1]==1{system("cat Input_file2")} 1' Input_file1
Output will be as...
4,846
Posted By Scrutinizer
Another way: awk -v adj='plugin":...
Another way:
awk -v adj='plugin": "/rundb/api/v1/plugin/49/' '$0~adj{print p}{p=$4}' FS=\" RS=, file
1,843
Posted By Scrutinizer
Not quite. In the example given, this is always a...
Not quite. In the example given, this is always a sequence of class [[:blank:]] characters, irrespective of the value of IFS :...
Showing results 1 to 25 of 48

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