Operating System - HP-UX
1833431 Members
3683 Online
110052 Solutions
New Discussion

Re: NO IDEA WHERE TO START

 
SOLVED
Go to solution
wayne_104
Regular Advisor

NO IDEA WHERE TO START

Hi I have been asked to look at a list of htm files. I have no experince whatsoever with xml files.

I need to first find files with the KZ00000002
and then pull the KZ00000002 number to txt file.

below is the two types of data in the files.

can this be done in HP -UX

CYTOLOGY
6010112596
3839/05


BIOCHEMISTRY
1002000064
KZ00000002
6 REPLIES 6
Doug O'Leary
Honored Contributor

Re: NO IDEA WHERE TO START

Hey;

One good place to start would be putting an accurate description of the problem in the subject line so people will know what to expect when they open your message.

Assuming all htm files are in one directory:

perl -nle 'print $1 if (m{(m{(.*?)})' *htm

should do the trick.

Hope that helps.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
wayne_104
Regular Advisor

Re: NO IDEA WHERE TO START

Hi

This is the output.

Search pattern not terminated at -e line 1.
wayne_104
Regular Advisor

Re: NO IDEA WHERE TO START

This does not give me an error but does not give me output either.

perl -nle 'print $1 if (m{(m{(.*?)})})' *xml
Doug O'Leary
Honored Contributor
Solution

Re: NO IDEA WHERE TO START

Hey;

Typo: sorry about that. Bad thing about cutting/pasting from a different window:

perl -nle 'print $1 if ((m{(.*?)})' *htm

I had one too many m{'s in there.

the m{} syntax changes the normal search delimiter from / to {}

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
wayne_104
Regular Advisor

Re: NO IDEA WHERE TO START

Hi Doug

Looks like you had a typo again. one two few )

This works just fine.

perl -nle 'print $1 if ((m{(.*?)}))' *xml
wayne_104
Regular Advisor

Re: NO IDEA WHERE TO START

Thanks Doug really appreciate it.

perl -nle 'print $1 if ((m{(.*?)}))' *xml