?
Solved

perl print if and tabs

Posted on 2006-11-15
2
Medium Priority
?
211 Views
Last Modified: 2008-02-26
I need to print out a couple of parts of a certain line.

I need to fine all lines that contian "YSanchez4" and "summary=" from lines such as this one

[15/Nov/2006:22:10:34 +0000] usxsl069 cshttpd[14839]: General Notice: (SSL) : POST: /storeevents.wcap?id=5ph5rn0o0p0e5qm0&calid=YSanchez4&dtstart=20020101T120000&dtend=20020101T010000&summary=New Year's Day&desc=&location=United States&icsClass=PUBLIC&isAllDay=1&categories=Holiday&charset=UTF-8&fmt-out=text/xml


I need to print out the summary= and the start and end time.

From this line I would get a print out of:

summary=New Year's Day      20020101T120000      20020101T010000

I'm getting the summary=... but when I try to add a few tabs and the start and end times I'm just getting a blank output,
can't figure out what I'm doing wrong here.

This is giving me the 1st part of what I need, need some help to get the start and end times.

perl -ne 'print "$1\n" if /(summary=.*)&desc=/'


Thanks,
0
Comment
Question by:bt707
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 17951616
If dtstart, dtend, summary, and desc are always in the same order
perl -ne 'print "$3\t$1\t$2\n" if /dtstart=(.*?)&.*dtend=(.*?)&(summary=.*)&desc=/'
0
 

Author Comment

by:bt707
ID: 17951652
Thanks ozo, that's just what I was trying to do, I just added a "/YSanchez4/ &" to it and got just what I needed.

Thanks again!!!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question