Trying to get the word after specific word

1 view
Skip to first unread message

Adam Khoob

unread,
Mar 8, 2021, 3:41:30 PM3/8/21
to umb...@googlegroups.com
Good afternoon,

I am trying to extract a work that comes from a specific word in a file. 
does anyone have any idea?

for example my file contains a line like this:

<basicAuth xmi:id="BasicAuth_1234" usereid="12345" part="Incomeservice" />

I would like to get the value for id. 

thanks in advance for any suggestion.

-Adam

Bob

unread,
Mar 8, 2021, 4:36:59 PM3/8/21
to Adam Khoob, umb...@googlegroups.com
if I understand your question correctly

when you click application
it should open a new window.
there will be a box with the files, click OK
then on the left side where it says "text"
double click "index" and it should open the text on the right hand panel.

took me forever to figure this out.


if I misunderstood your question hope this helps someone else.
take care, wear the damn mask etc

Bob
> --
> You received this message because you are subscribed to the Google Groups "UMBC
> Linux Users' Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> umbclug+u...@googlegroups.com.
> To view this discussion on the web visithttps://groups.google.com/d/msgid/umbclug/1213642560.508992.1615235967098%40mail.ya
> hoo.com.
>
>

Rouben Rostamian

unread,
Mar 8, 2021, 10:39:20 PM3/8/21
to Adam Khoob, umb...@googlegroups.com
Here is how with "sed":

sed -n -e '/usereid/{s/.*usereid="\([0-9][0-9]*\)".*/\1/;p}' < datafile

On Mon, Mar 08, 2021 at 08:39:27PM +0000, 'Adam Khoob' via UMBC Linux Users' Group wrote:
> From: 'Adam Khoob' via UMBC Linux Users' Group <umb...@googlegroups.com>

Yaakov Freedman

unread,
Mar 9, 2021, 6:10:17 AM3/9/21
to Rouben Rostamian, Adam Khoob, umb...@googlegroups.com
With plain old Regex, I do this one of two ways.

The first way is using Regex’s ‘look ahead’ feature, which is not always available for a particular platform, which brings me to method two.

I create two capture groups, one contains the text that comes ‘before’ and one group contain all the subsequent text. I then simply discard the first group and keep the second.

I hope this helps! I do this second method all the time. Let’s say I have a field in a text document like so “Total: 50”, the first group is “Total:” and the subsequent group is anything that comes afterward and matches certain rules.

Sincerely,
Yaakov Freedman

> On Mar 8, 2021, at 10:39 PM, Rouben Rostamian <rost...@umbc.edu> wrote:
>
> Here is how with "sed":
> --
> You received this message because you are subscribed to the Google Groups "UMBC Linux Users' Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to umbclug+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/umbclug/YEbt5R75%2BBzcDd4N%40shadow.

Adam Khoob

unread,
Mar 9, 2021, 10:23:10 AM3/9/21
to Rouben Rostamian, Yaakov Freedman, umb...@googlegroups.com
thanks everyone.

> To unsubscribe from this group and stop receiving emails from it, send an email to umbclug+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "UMBC Linux Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to umbclug+unsub...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/umbclug/C424DA69-5B85-4DA2-945F-33DD3A7200FE%40umbc.edu.

Reply all
Reply to author
Forward
0 new messages