Finding a string inside A Tag


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding a string inside A Tag
# 1  
Old 08-09-2010
Finding a string inside A Tag

I have umpteen number of files containing HTML A tags in the below format

Quote:
<a href="someurl.jsp?someparam&Login=$(someloginvalue)">
or

Quote:
<a href="someurl.jsp?Login=$(someloginvalue)">
I want to find all the lines that contain the word Login=

I used this command

Code:
grep "Login=" *

This gave me normal lines as well which contain the word Login= for example, it returned lines which have

Quote:
Login=AssignSomeValue;
this.Login=someValue;
How can I extract only those files which contain Login= in a A tag? Is it possible if yes, how can I do it?
# 2  
Old 08-09-2010
Hi.

Try:
Code:
grep "<a[^>]*Login="


Last edited by Scott; 08-09-2010 at 08:47 AM..
# 3  
Old 08-09-2010
Something like this?
Code:
awk '/^</ && /Login=/' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to print string if tag is specific value

In the below awk I am trying to print expName only if another tag planExecuted is true. In addition to the expName I am also printing planShortID. For some reason the word experiment gets printed so I remove it with sed. I have attached the complete index.html as well as included a sample of it... (1 Reply)
Discussion started by: cmccabe
1 Replies

2. Shell Programming and Scripting

How to check empty string in an XML tag?

I have an XML tag <abc> which is empty as <abc></abc>.If the the tag is empty I want to flag the file as bad. Please help. Thanks (3 Replies)
Discussion started by: aneeta13
3 Replies

3. Shell Programming and Scripting

How can i find texts inside a html tag using sed?

How can i find texts inside a html tag using sed? Html texts: What i tried: cat infile | sed -e 's/\(<kbd*\)\(.*\)\(kbd>\)/\2/ Expected result like this: sed -i -e 's/@colophon/@@colophon/' \ -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo (5 Replies)
Discussion started by: cola
5 Replies

4. Shell Programming and Scripting

Extracting a string from html tag

Hi I am new to string extractions in shell script... I am trying to extract a string such as #1753 from html tag looks like below. <a class="model-link tl-tr" href="lastSuccessfulBuild/">Last successful build (#1753), 40 min ago</a> and want the value as 1753 Could someone help me to... (3 Replies)
Discussion started by: hicharbo
3 Replies

5. Programming

Deciphering a tag character string

I have a string, eg 7f30.3 and I want to store things in the following way npos = 7 decform = true width = 30 ndp = 3 I need to read each character one by one. I am coding in fortran but I can try to code it should answer be given in C in the above way. (2 Replies)
Discussion started by: kristinu
2 Replies

6. Shell Programming and Scripting

How to remove string inside html tag <a>

Does anybody know how i can remove string from <a> tag? There are several hundred posts in a few forums that need to be cleaned up. The precise situation is ---------- <a href="http://mydomain.com/cgi-bin/anyboard.cgi?fvp=/family/sexuality_and_spirituality/&cmd=rA&cG=43"> ------------- my... (6 Replies)
Discussion started by: georgi58
6 Replies

7. UNIX for Dummies Questions & Answers

Finding files with a certain name string inside of another file.

Hi, I have a very large file that contains a listing of all files on the system. I need to create a listing from that file of all files that start with the following format: s???_*, whereas the '?' represents characters, so the file name begins with an 's' followed by three other characters and... (4 Replies)
Discussion started by: tes218
4 Replies

8. Shell Programming and Scripting

Extract value inside <text> tag for a particular condition.

Hi All! I have obtained following output from a tool "pdftohtml" :: So, my input is as under: <text top="246" left="160" width="84" height="16" font="3">Business purpose</text> <text top="260" left="506" width="220" height="16" font="3">giving the right information and new insights... (3 Replies)
Discussion started by: parshant_bvcoe
3 Replies

9. Shell Programming and Scripting

Capturing string between a xml tag

Hi All, I have an XML-: <ProcId>CES_P5010_AddVLan</ProcId> <DataVersion>yxcxycyxcycyxc</DataVersion> <JobId>OR3000055-002-1</JobId> </CesHeader> <VLanServiceList> <NopId>blu</NopId> </VLanServiceList> <StatusNPA>2</StatusNPA> ... (5 Replies)
Discussion started by: amit_iti
5 Replies

10. UNIX for Dummies Questions & Answers

finding text inside file

Hi everyone I have a small problem i cant find a soloution to... I'm using digital unix and have to find out all the files which have a certain string inside them and i dont know how to do it. *This search is done as root. *All files from '/' to the last directory should be searched for... (3 Replies)
Discussion started by: dindan100
3 Replies
Login or Register to Ask a Question