Search Results

Search: Posts Made By: Ariean
6,499
Posted By Don Cragun
Try: awk -F '[(] *Host *= *' 'NF>1{print...
Try:
awk -F '[(] *Host *= *' 'NF>1{print substr($2, 1, match($2, / *[)]/) - 1)}'
6,499
Posted By RudiC
Your approach is not bad. Try to capture the...
Your approach is not bad. Try to capture the first occurrence of the delimiter, not the last one:awk '/Host/{match($0,/(Host =[^)]*)/);print substr($0,RSTART+7,RLENGTH-7)}' file
2,209
Posted By Don Cragun
I didn't say to look at the HISTORY man page; I...
I didn't say to look at the HISTORY man page; I said to look at the man page for your shell (ksh in this case) and look for the HIStORY environment variable on that man page.

If you're users are...
1,153
Posted By Corona688
It is, actually, but /ID/ is not a variable. Try...
It is, actually, but /ID/ is not a variable. Try this:

echo asdf | awk '{ print /qwerty/ }'

/qwerty/ is an expression meaning 'check if the line matches this'. It becomes 1 if it does, 0 if...
1,372
Posted By RavinderSingh13
Hello Ariean, One more approach for same. ...
Hello Ariean,

One more approach for same.

awk '!/gpg/ {count++;match($0,/<.*>/);print substr($0,RSTART+1,RLENGTH-2)} END{print count}' Input_file


Output will be as follows.

xyz@abc.com...
1,372
Posted By Corona688
To print a count, one must take a count. awk...
To print a count, one must take a count.
awk -F"[<>]" '/@/ {L++ ; print $2} END{print L+0}'
1,372
Posted By Corona688
awk -F"[<>]" '/@/ { print $2 }'...
awk -F"[<>]" '/@/ { print $2 }' inputfile
10,886
Posted By Don Cragun
If the pattern for which you want to change the...
If the pattern for which you want to change the value (in this case SOURCEFOLDERNAME) can only occur on one line in your input file, the following ed command will update the line containing that...
10,886
Posted By MadeInGermany
sed does not return the status of the last match...
sed does not return the status of the last match or substitute command.
You can use an extra grep for this
grep 'SOURCEFOLDERNAME=' DepFolderControlFile.xml
saveexit=$?
sed -i...
9,127
Posted By Akshay Hegde
Try $ awk -F'[<> ]' '{ $1 = $1 }$2 !~...
Try

$ awk -F'[<> ]' '{ $1 = $1 }$2 !~ /^[[:punct:]]/ && !a[$2]++{print "<"$2">"}' file.xml

---------- Post updated at 10:30 PM ---------- Previous update was at 10:24 PM ----------

OR
$ awk...
9,127
Posted By Yoda
Try something like this:- awk -F'[<> ]' ' ...
Try something like this:-
awk -F'[<> ]' '
{
sub(/\//,x,$2)
if ( $2 !~ /xml/ )
A[$2]
}
END {
for...
9,127
Posted By Chubler_XL
If you have more than 1 tag per line something...
If you have more than 1 tag per line something like this may be more accurate:

awk -F '[> ]' '! /^[/?]/ && length($1) && !h[$1]++ {print RS $1 ">" }' RS=\< infile
9,127
Posted By RavinderSingh13
Hello Ariean, Following may help. ...
Hello Ariean,

Following may help.


awk '{
match($0,/<\/.*>/);
b=substr($0,RSTART,RLENGTH);
if(b)
{a[++i]=b}
}
END{
{for(k in a)
{c[a[k]]=k}
}
{for(u in c)
...
2,386
Posted By Corona688
All your encoding / decoding code is pointless...
All your encoding / decoding code is pointless because:

Encryption does not work that way.

Forgive me for being a bit emphatic, but we get these threads very often.

I can decrypt them from...
2,386
Posted By rbatte1
If your problem is about securing the password...
If your problem is about securing the password for a particular Oracle DB account, could you set up the OS account as (for instance) myapp1 and in the database, the account with:-create user...
5,808
Posted By Don Cragun
Sorry about that, try this: awk ' BEGIN { FS...
Sorry about that, try this:
awk '
BEGIN { FS = RS = ">"
ORS = ">\n"
}
!/^</ { out = out ">" $1
next
}
{ print out
out = $1
}
END { print out
}' 2014-03-31_17_V2.5.XML.utf8
2,327
Posted By RudiC
Does it? Not for me: . . . ...
Does it? Not for me:
. . .
<RELATED_PARTY_LOAN_CODE>0</RELATED_PARTY_LOAN_CODE>
. . .
2,327
Posted By Corona688
I thought all awk had -e. Oh well. Stripped it...
I thought all awk had -e. Oh well. Stripped it down to a faster program which doesn't need -e:

$ ls -lh filter.xml
-rw-r--r-- 1 user user 451M Sep 3 14:10 filter.xml

$ time awk 'NR==1 {...
3,657
Posted By Don Cragun
You tell us that awk is buffering output sent...
You tell us that awk is buffering output sent through a pipe. By closing the pipe to readcounts after writing each count, the buffering problem is eliminated. Unfortunately, it also means that...
3,657
Posted By Don Cragun
Testing the scripts I gave you on Mac OS X with a...
Testing the scripts I gave you on Mac OS X with a program that writes one line into s_GenerateXMLDataFile.log every two seconds and the
getcounts | readcounts
pipeline was printing three lines very...
3,657
Posted By Don Cragun
In the commands: trap 'kill $(cat...
In the commands:
trap 'kill $(cat $$.tailpid);rm -f $$.tailpid' EXIT
(tail -f -n +1 s_GenerateXMLDataFile.log& echo $! > $$.tailpid) | awk '...'
tail -f -n +1 s_GenerateXMLDataFile.log&
starts...
3,657
Posted By Don Cragun
As long as your asynchronous writer will always...
As long as your asynchronous writer will always eventually write a line of the format:
DIRECTOR> TM_6020 Session [s_GenerateXMLDataFile] completed at [Mon Jun 02 15:32:02 2014].
into your log file...
3,657
Posted By Aia
Only unique: awk '$3 ~ /X_fc_Loan/ && $6 ==...
Only unique:
awk '$3 ~ /X_fc_Loan/ && $6 == "[XMLTgt_FCSLOANS_Ver25_Norm])" {getline; if($5=="Requested:")a[$6]} END { for (k in a) print k }' file

Last instance as a whole:
awk '$3 ~...
3,657
Posted By Aia
@Ariean The issue is that you say: ...
@Ariean

The issue is that you say:


However, in the attached file, X_fc_Loan appears all over in context that it doesn't provide a following line with meaningful data, in fact, if we collect...
2,201
Posted By vgersh99
awk ' # if the first field starts with WRITER_,...
awk '
# if the first field starts with WRITER_, set the flag p to 1 and skip to processing the next line
$1 ~ "^WRITER_" {p=1;next}

# if flag p is not 0 AND there's a string X_fc_Loan on current...
Showing results 1 to 25 of 80

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