![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk: need to extract a line before a pattern | npn35 | Shell Programming and Scripting | 17 | 06-29-2008 10:38 PM |
| extract a particular start and end pattern from a line | manish205 | Shell Programming and Scripting | 7 | 02-07-2008 06:18 AM |
| Extract Pattern Sequence | jaganadh | Shell Programming and Scripting | 5 | 12-10-2007 11:06 AM |
| Extract if pattern matches | Raynon | Shell Programming and Scripting | 20 | 10-29-2007 04:44 AM |
| Extract the Pattern | aajan | UNIX for Dummies Questions & Answers | 6 | 08-08-2007 04:47 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Please help! Sed extract a pattern
I am trying to extract "securitySettings" out of line:
<a ref ="http://localhost:5654/securitySettings"> using sed as follows: name = `grep "localhost" file.html | sed -n 's/.*[0-9]*\/\(.*)/\">/\1/p'` But it didn’t run, seems have some syntax error. Do anybody knows why? Thank you very much! |
|
||||
|
can be don in a much more simpler way as follows(i mean there is lesser chance of getting lost in sed
)Code:
grep "loaclhost" file.html | awk -F'/' '{print $NF }' | sed -e 's/>//g'
|
|
||||
|
Quote:
Code:
grep "securitySettings" file.html if [ $? -eq 0 ]; then name='securitySettings' fi |
|
||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|