Sponsored Content
Top Forums Shell Programming and Scripting Regular Expression needed for the xml Post 302828777 by ameyrk on Wednesday 3rd of July 2013 07:05:38 AM
Old 07-03-2013
Thanks Ravi and Balaji.

Its working but I have pretty lenghty xml and it matches everything, where ever the string occurs. I want these specific 5 lines in my output and not rest.

How that can be done? Also could you please what is does ' , ' coma means ? Is it a new line ?

---------- Post updated at 06:05 AM ---------- Previous update was at 05:27 AM ----------
Code:
awk '/\<tokenValue\>/,/\<sessionStatus\>Active\<\/sessionStatus\>/,/\<loginTime\>.*.\<\/loginTime\>/,/\<\/sessionToken\>/,/\<userName\>amey<\/userName\>/'  filename

I tried this its giving me syntax error. Could you please correct this ?
Code:
awk: /\<tokenValue\>/,/\<sessionStatus\>Active\<\/sessionStatus\>/,/\<loginTime\>.*.\<\/loginTime\>/,/\<\/sessionToken\>/,/\<userName\>amey<\/userName\>/
awk:                                                              ^ syntax error
awk: /\<tokenValue\>/,/\<sessionStatus\>Active\<\/sessionStatus\>/,/\<loginTime\>.*.\<\/loginTime\>/,/\<\/sessionToken\>/,/\<userName\>amey<\/userName\>/
awk:                                                                                                                     ^ syntax error


Last edited by Franklin52; 07-03-2013 at 08:28 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular Expression + Aritmetical Expression

Is it possible to combine a regular expression with a aritmetical expression? For example, taking a 8-numbers caracter sequece and casting each output of a grep, comparing to a constant. THX! (2 Replies)
Discussion started by: Z0mby
2 Replies

2. Shell Programming and Scripting

regular expression help

hello all.. I'm a bit new to this site.. and I hope to learn alot.. but I've been having a hard time figuring this out. I'm horrible with regular expressions.. so any help would be greatly appreciated. I have a file with a list of names like this: LASTNAME, FIRSTNAME, MIDDLEINITIAL how can... (5 Replies)
Discussion started by: mac2118
5 Replies

3. Programming

help in regular expression

Hi all, I'm working with flex (version 2.5.4a) on GNU/linux. I need to frame a regular expression which would match cases where word "file" does not occur. Negated character class wont work for me because they enforce "or" clause between different chars (so something like wont work). I would like... (5 Replies)
Discussion started by: Rakesh Ranjan
5 Replies

4. Linux

Regular expression to extract "y" from "abc/x.y.z" .... i need regular expression

Regular expression to extract "y" from "abc/x.y.z" (2 Replies)
Discussion started by: rag84dec
2 Replies

5. Shell Programming and Scripting

Integer expression expected: with regular expression

CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error. source $CA_VERSION_DATA if * ] then echo "CA_RELESE $CA_RELEASE is invalid" exit -1 fi + source /etc/ncgl/ca_version_data ++ CA_PRODUCT_ID=samxts ++ CA_RELEASE=6 ++ CA_WEEK_NO=7 ++... (3 Replies)
Discussion started by: ketkee1985
3 Replies

6. UNIX for Dummies Questions & Answers

Regular expression help needed

Hi I need to simplify this reg expression is this right or thanks. (1 Reply)
Discussion started by: drew211
1 Replies

7. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

8. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

9. Shell Programming and Scripting

Regular expression for XML request and response

Hi Gents, I am having a xml request, I need to match the entire paragraph in unix regex. Can some one please provide me the regex for unix. I need to embed this in a shell script. Below is the XML. I am bit weak in regular expression. Regex *testameykamble* here testameykamble is my key... (8 Replies)
Discussion started by: ameyrk
8 Replies

10. Shell Programming and Scripting

Regular expression needed

Hi Folks i have text file which have oracle table creation script for ex create table schema.table_name1 (col1 number,col2 number); create table schema.table_name2 (col3 number,col4 number); like that. here i want only 'table_name' . how can i find ? can you pls help the output... (3 Replies)
Discussion started by: coolboy98699
3 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 04:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy