03-11-2009
Select particular string using AWK
Hi all,
i searched this forum for the awk help i needed but i couldnt get any thread matching to my problem,
My problem is
i have a file
file1 {
<Server CloneID="13k6equ4c" Name="EnterpriseServicesClone2">
<Server CloneID="13k6eqvi1" Name="EnterpriseServicesClone1">
<Server CloneID="13k6er1lu" Name="INTLEStatementClone1">
<Server CloneID="13k6er4id" Name="GlobalMRClone1">
<Server CloneID="13k6er6lg" ConnectTimeout="3" Name="GlobalUserManagementClone1">
<Server CloneID="13k6erbi4" ConnectTimeout="3" Name="USEStatementClone1">
<Server CloneID="13k6erd1h" ConnectTimeout="3" Name="USEStatementClone2">
<Server CloneID="13k6erfkj" Name="MYCAServicesClone2">
<Server CloneID="13k6erh8n" Name="MYCAServicesClone1">
<Server CloneID="13k6erk21" Name="DocGenClone1">
<Server CloneID="13k6ern9r" Name="OnlineDisputesClone1">
<Server CloneID="13k6erqb0" Name="TransferClone1">
<Server CloneID="13ta8bqd3" Name="BasicServicesClone2">
<Server CloneID="13tacbiag" Name="BasicServicesClone1">
<Server CloneID="13k6er95a" ConnectTimeout="3" Name="USAccountSummaryClone1">
<Server CloneID="13v8rg2qo" ConnectTimeout="3" Name="USAccountSummaryClone2">
}
Now my problem is i want output as:
EnterpriseServicesClone2
EnterpriseServicesClone1
INTLEStatementClone1
GlobalMRClone1
GlobalUserManagementClone1
USEStatementClone1
USEStatementClone2
MYCAServicesClone2
MYCAServicesClone1
DocGenClone1
OnlineDisputesClone1
TransferClone1
BasicServicesClone2
BasicServicesClone1
USAccountSummaryClone1
USAccountSummaryClone2
but when i am using command as
awk -F"Name" '{print $2}' | |awk -F"\"" '{print $2}'
i am not getting the proper output
The output is coming like this:
ame="EnterpriseServicesClone2
ame="EnterpriseServicesClone1
ame="I
ame="GlobalMRClone1
ame="GlobalUserManagementClone1
ame="USEStatementClone1
ame="USEStatementClone2
ame="MYCAServicesClone2
ame="MYCAServicesClone1
ame="DocGenClone1
ame="OnlineDisputesClone1
ame="TransferClone1
ame="BasicServicesClone2
ame="BasicServicesClone1
ame="USAccountSummaryClone1
ame="USAccountSummaryClone2
Can anybody help??
Thanks in advance..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All ,
I have file1.txt contain values like the following:
----------
23
24
25
and I have shell script which has the following :
more file1.txt | awk '{print "select 'DUMP',CODE1||'|'||CODE2||'|'||CODE3 from CODE where CODE1='" $1 "';"}' > file2.sql
all I need is to have the... (6 Replies)
Discussion started by: habuzahra
6 Replies
2. Shell Programming and Scripting
Hi,
I am new to this world of shell programming. I am facing a problem that is :
I have directory which has many sub directories at different depth. say
A/B/C/files
A/B/files
A/B/C/D/files
In this directory structure there exists a file called ".project" in some of the sub... (2 Replies)
Discussion started by: bhaskar_m
2 Replies
3. Shell Programming and Scripting
I've got a web access file that I want to grep (or awk or perl or whatever will work!) out the most frequent instances of unique IP entries. Meaning the file looks something like this:
I'd like to run a sort or grep (or whatever) that will only select out the lines from IP's that had the... (7 Replies)
Discussion started by: kevinmccallum
7 Replies
4. Shell Programming and Scripting
Hi all,
I have a string that looks like:
#!/bin/sh
options="arguments: --user=alpha --group=beta --prefix=/usr/share --proxy-path=/proxy --proxy-tmp=/tmp --conf-path=/etc"
My goal is to transform the string into an array, then for each key, if it starts with "--proxy" to print the string... (2 Replies)
Discussion started by: TECK
2 Replies
5. Shell Programming and Scripting
Okay -- I hope I ask this correctly.
I'm working on my little shell script to write vendor names and aliases to files from user input. If a user choose to add to a file, he can do that as well. I'm using a select loop for this function to list all the possible files the user can choose from.... (7 Replies)
Discussion started by: Straitsfan
7 Replies
6. Shell Programming and Scripting
I am learning sed/awk. So, bear with me.
I have successfully created a list (based on sed) which looks like:
<cl:item href="clsysrev/XTT004/XTT05064.xml" productSubtitle="animals" unitStatus="today"IR">
<cl:item href="clsysrev/XTT007/XTT08581.xml" productSubtitle="humans"... (3 Replies)
Discussion started by: alonso_canada
3 Replies
7. Shell Programming and Scripting
If i have a log file record.txt, with 10 fields
- First field is datetime
- 7th field is status
- 8th filed is name
- The last field (10th) is epoch time of the first field
02/17/2012 1:47 PM||||||In Use|chicken||1329515230
02/17/2012 2:53 PM||||||Available|chicken||1329519195
02/17/2012... (4 Replies)
Discussion started by: sabercats
4 Replies
8. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
9. UNIX for Dummies Questions & Answers
Hi
I have a number of sequences and a string occurs a number of times in that sequence.
How can I select and replace only those strings which are followed by \tab.
for eg :
my sequence looks like :
string0 positive cd parent=string0 id =121 string0
string0 negative ef parent=... (2 Replies)
Discussion started by: sonia102
2 Replies
10. Programming
Hey Guys,
I'm using SQuirreL SQL v3.5 GUI to fetch some data that I need for something I'm working on. I'm also using the IBM Informix Driver (*Version 3.5) to connect to the Database.
What I want to do, if it's even possible, is to show all COLUMNS if they contain the word "Email".
So in... (2 Replies)
Discussion started by: mrm5102
2 Replies
LEARN ABOUT DEBIAN
combine
COMBINE(1) COMBINE(1)
NAME
combine - combine sets of lines from two files using boolean operations
SYNOPSIS
combine file1 and file2
combine file1 not file2
combine file1 or file2
combine file1 xor file2
_ file1 and file2 _
_ file1 not file2 _
_ file1 or file2 _
_ file1 xor file2 _
DESCRIPTION
combine combines the lines in two files. Depending on the boolean operation specified, the contents will be combined in different ways:
and Outputs lines that are in file1 if they are also present in file2.
not Outputs lines that are in file1 but not in file2.
or Outputs lines that are in file1 or file2.
xor Outputs lines that are in either file1 or file2, but not in both files.
"-" can be specified for either file to read stdin for that file.
The input files need not be sorted, and the lines are output in the order they occur in file1 (followed by the order they occur in file2
for the two "or" operations). Bear in mind that this means that the operations are not commutative; "a and b" will not necessarily be the
same as "b and a". To obtain commutative behavior sort and uniq the result.
Note that this program can be installed as "_" to allow for the syntactic sugar shown in the latter half of the synopsis (similar to the
test/[ command). It is not currently installed as "_" by default, but you can alias it to that if you like.
SEE ALSO
join(1)
AUTHOR
Copyright 2006 by Joey Hess <joey@kitenet.net>
Licensed under the GNU GPL.
moreutils 2012-04-09 COMBINE(1)