03-24-2009
How to get value between patterns
Gurus,
If is my file
<PRODUCT_TYPE>DN</PRODUCT_TYPE><SERVER_NAME>testserver1</SERVER_NAME><FLAVOR>Windows</FLAVOR><OS>Windows NT</OS><CPU>4</CPU>
<PRODUCT_TYPE>PN</PRODUCT_TYPE><SERVER_NAME>testserver2</SERVER_NAME><FLAVOR>Windows</FLAVOR><OS>Windows NT</OS><CPU>3</CPU>
<PRODUCT_TYPE>QN</PRODUCT_TYPE><SERVER_NAME>testserver3</SERVER_NAME><FLAVOR>Unix</FLAVOR><OS>Windows NT</OS><CPU>2</CPU>
Output shud be
DN testserver1 Windows Windows NT 4
PN testserver2 Windows Windows NT 3
QN testserver3 Windows Windows NT 2
Basically i want to print values between <> & </>
Thanks
Sirabee
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
hello, I want to write a script to find all the files that contain 3 specific patterns. example: shows the files containing any line that contain pattern1, pattern2 and pattern3, but the patterns can be in any order as long as they exist in the line.
can I do that with grep?
thank you (1 Reply)
Discussion started by: bashuser
1 Replies
2. Shell Programming and Scripting
hello experts,
I want to get the value between 2 patterns.
ex. get hello in <line>hello</line>
Any suggestions?
any sed, grek, awk commands? (11 Replies)
Discussion started by: minifish
11 Replies
3. Shell Programming and Scripting
Hi Gurus,
I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies
4. Shell Programming and Scripting
Hi,
i have a directory /u02.i have 2 files in it like abc1.gz abc2.gz i want to store file pattern in a variable like
f1="abc?"
i don't want to take .gz in variable rather i want .gz appended when i need to unzip the file like
gunzip $f1
Can you please help me how to... (3 Replies)
Discussion started by: malikshahid85
3 Replies
5. Shell Programming and Scripting
Hi,
i have following lines of code which is properly working.
CAT1="${InputFile}CAT_*0?????"
CAT2="${InputFile}CAT_*0?????"
CountRecords(){
integer i=1
while ]; do
print P$i `nawk 'END {print NR}' $1 ` >> ${OutputPath}result.txt &
i=i+1
shift
done
}
CountRecords "$CAT1"... (8 Replies)
Discussion started by: malikshahid85
8 Replies
6. Shell Programming and Scripting
Hi All,
I've been trying solve this with a simple command but not having much luck. I have a file like this:
Line 1: random_description 123/alert/high random_description2 356/alert/slow
Line 2: random_description3 654/alert/medium
Line 3: random_description4 234/alert/critical
I'm... (7 Replies)
Discussion started by: joe19
7 Replies
7. UNIX for Dummies Questions & Answers
Hi everyone,
I am new to this forum. So I apologize if my question is too basic. I am trying to find the amount of words I have in a large number of XML files. Of course I do not want to count XML tags (<.*?>). But i do not know how to do it .:wall: Is there an easy way? (By the way I am working... (7 Replies)
Discussion started by: mcptrad
7 Replies
8. Shell Programming and Scripting
hi guys
in my bash script I call wget to check for valid links like this:
wget -q "$1" -O- | grep -ow "href=\"http://*\"" | sed -e 's/href=//g' -e 's/"//g'
but this only finds the urls starting with http.What if I also want to find the urls starting with Https and https? (2 Replies)
Discussion started by: vlm
2 Replies
9. Shell Programming and Scripting
Hi,
I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Discussion started by: redse171
3 Replies
10. Shell Programming and Scripting
Hello.
For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
LEARN ABOUT CENTOS
hivexget
hivexget(1) Windows Registry hivexget(1)
NAME
hivexget - Get subkey from a Windows Registry binary "hive" file
SYNOPSIS
hivexget hivefile 'PathToSubKey'
hivexget hivefile 'PathToSubKey' name
NOTE
This is a low-level tool. For a more convenient way to navigate the Windows Registry in Windows virtual machines, see virt-win-reg(1).
For proper regedit formatting, use hivexregedit(1).
DESCRIPTION
This program navigates through a Windows Registry binary "hive" file and extracts either all the (key, value) data pairs stored in that
subkey or just the single named data item.
In the first form:
hivexget hivefile 'PathToSubKey'
"hivefile" is some Windows Registry binary hive, and "PathToSubkey" is a path within that hive. NB the path is relative to the top of
this hive, and is not the full path as you would use in Windows (eg. "HKEY_LOCAL_MACHINESYSTEM" is not a valid path).
If the subkey exists, then the output lists all data pairs under this subkey, in a format similar to "regedit" in Windows.
In the second form:
hivexget hivefile 'PathToSubKey' name
"hivefile" and path are as above. "name" is the name of the value of interest (use "@" for the default value).
The corresponding data item is printed "raw" (ie. no processing or escaping) except:
1. If it's a string we will convert it from Windows UTF-16 to UTF-8, if this conversion is possible. The string is printed with a single
trailing newline.
2. If it's a multiple-string value, each string is printed on a separate line.
3. If it's a numeric value, it is printed as a decimal number.
SEE ALSO
hivex(3), hivexml(1), hivexsh(1), hivexregedit(1), virt-win-reg(1), guestfs(3), <http://libguestfs.org/>, virt-cat(1), virt-edit(1).
AUTHORS
Richard W.M. Jones ("rjones at redhat dot com")
COPYRIGHT
Copyright (C) 2009 Red Hat Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
hivex-1.3.8 2012-12-03 hivexget(1)