02-24-2012
I have a file like this:
%
10
%
NAME_1
NAME_2
NAME_3
NAME_4
%
LOCAL
%
02/02/12
%
08:00:00
%
YES
%
Where I need to change the value of LOCAL to POINT. Since the value of LOCAL is dynamic (it can assume any text), I thought of using % as the separator. It should change the value of text that is after the 3rd occurrence of % . So the output should be like:
%
10
%
NAME_1
NAME_2
NAME_3
NAME_4
%
POINT
%
02/02/12
%
08:00:00
%
YES
%
Your help is much appreciated.
Thanks,
Arun
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Friends,
I am new to the scripting & have to analyze bunch of regular production scripts. It has .ksh which calls on the .awk script having many functions
I need to understand and debug the scripts ASAP
Can anybody please let me know as how can I debug, I want to see the flow of code... (3 Replies)
Discussion started by: amberj123
3 Replies
2. Shell Programming and Scripting
Hi Guys,
I was recently come across some code to hopefully learn a little bit about putting Shell commands into PHP application to run on a Linux server. However, I don't understand the command AT ALL... and was wondering if anyone can interpret it:
cat userIDs.dat | awk '{s=s+1; if... (1 Reply)
Discussion started by: jordRiot
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
It can be used awk inside other Awk?. I need to get another text processing while other text process.
Thank you. (2 Replies)
Discussion started by: pepeli30
2 Replies
4. UNIX for Dummies Questions & Answers
Hi
I have an awk script running in ksh in which a section of code is picking out the datetime as follows:
dia=`echo $starttime | nawk '{ printf "%02d\n", substr($1,9,2)}'`
mes=`echo $starttime | nawk '{ printf "%02d\n", substr($1,6,2)}'`
ano=`echo $starttime | nawk '{ printf "%02d\n",... (3 Replies)
Discussion started by: shajju
3 Replies
5. UNIX for Advanced & Expert Users
i am analyzing a query written by another developer ,need to understand part of script
am looking at a code ..and it converts comma files to pipe delimited and also takes away quotes from any columns,
source field format: 2510,"Debbie",NewYork
changes to
target: 2510|Debbie|NewYork
... (1 Reply)
Discussion started by: coolrock
1 Replies
6. UNIX for Dummies Questions & Answers
Hey all,
So I have an AWK command here
awk '{if(FNR==NR) {arr++;next} if($0 in arr) { arr--; if (arr == 0) delete arr;next}{print $0 >"list2output.csv"}} END {for(i in arr){print i >"list1output.csv"}}' list1 list2
(refer to image for a more readable format)
This code was submitted... (1 Reply)
Discussion started by: Aussiemick
1 Replies
7. Shell Programming and Scripting
Hi Experts,
I was looking at the below link, for finding words next to it, And unable to understand this syntax:
Can any one please explain , what is meaning of this code:
if ( F )
s = s ? s OFS $i : $i
from:... (4 Replies)
Discussion started by: rveri
4 Replies
8. UNIX for Dummies Questions & Answers
I found this on an awk site and would like to know what it does:
/CARS/{x="";next} {if(x)print x;x=$0} END{if(x)print x}'
Does it mean if it finds the word cars it skips that line and then prints the next one? (4 Replies)
Discussion started by: newbie2010
4 Replies
9. Shell Programming and Scripting
Hello
I am working on a Change request and Stuck at a point. The below awk command is used in the function.
float_test ( ) {
echo | awk 'END { exit ( !( '"$1"')); }'
}
I understand that awk 'END' is used to add one line at the end and exit is used to end the script with an error... (4 Replies)
Discussion started by: rahul2662
4 Replies
10. Shell Programming and Scripting
Heyas
Recently i wanted to help someone with an awk script, but the end-script didnt work as expected.
He wanted, if HOME was empty, to get the HOME of the current USER from /etc/passwd.
At first i tried hardcoded with root:
awk -F: '/^root/ {print $6}' /etc/passwd
As that worked, i've... (4 Replies)
Discussion started by: sea
4 Replies
LEARN ABOUT CENTOS
osinfo-db-validate
OSINFO-DB-VALIDATE.C(1) Virtualization Support OSINFO-DB-VALIDATE.C(1)
NAME
osinfo-db-validate - Validate libosinfo XML data files
SYNOPSIS
osinfo-db-validate [OPTIONS...] LOCAL-PATH1 [LOCAL-PATH2...]
osinfo-db-validate [OPTIONS...] URI1 [URI2...]
DESCRIPTION
Check that all files ("LOCAL-PATH1" or "URI1") comply with the libosinfo XML schema. The local path may point to a directory containing XML
files, or directly to an XML file. The uris must point directly to remote XML files
Any validation errors will be displayed on the console when detected.
OPTIONS
-v, --verbose
Display verbose progress information when validating files
EXIT STATUS
The exit status will be 0 if all files passed validation, or 1 if a validation error was hit.
SEE ALSO
xmllint(1)
AUTHORS
Daniel P. Berrange <berrange@redhat.com>
COPYRIGHT
Copyright (C) 2012 Red Hat, Inc.
LICENSE
"osinfo-db-validate" is distributed under the termsof the GNU LGPL v2+ license. This is free software; see the source for copying
conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
libosinfo-0.2.7 2013-02-26 OSINFO-DB-VALIDATE.C(1)