Do not use on any
shared computer
July 25, 2008 02:36pm pdt
null
[x]
Attachment Details

perl one liner -  loop through list

I have a file that has hundreds of user records in it which each user record is separated with a new line

I'm using a perl command such as

perl -n00e 'print if (/^gram-20020624|^gram-20020624:Support|^david-20010801c/)' list-file.txt

This command will pull out the user records for these 3 accounts
gram-20020624   gram-20020624:Support   david-20010801c

Problem I have is I have a few hundred of the records that I need to pull out and cannot put all of them on the line of the command.

I've tried to put the list of names in a file then create a small perl script and put the list in a array then do a foreach with it but it's not working.

The one liner I used above will pull out these 3 records and look like

david-20010801c: owner=david-20010801c status=enabled
 name=David Doe
 description=
 other owners=
 double book=yes
 aces=@@o^c^wdeic^g;@@o^a^rsf^g;@^a^sf^g;@^c^^g;@^p^r^g
 email=
 time zone=
 categories=
 character set=
 language code=en
 created=Mar 10, 2005 21:53:44 GMT
 last modified=Dec 04, 2005 02:37:42 GMT
 events last modified=Jun 29, 2006 16:23:32 GMT
 todos last modified=Mar 10, 2005 21:53:44 GMT
 deletelog last modified=Mar 10, 2005 21:53:44 GMT
 number of events=36
 number of tasks=0

gram-20020624: owner=gram-20020624 status=enabled
 name=gram Morgan
 description=
 other owners=
 double book=yes
 aces=@@o^c^wdeic^g;@@o^a^rsf^g;@^a^sf^g;@^c^^g;@^p^r^g
 email=
 time zone=
 categories=
 character set=
 language code=en
 created=Feb 21, 2007 15:20:18 GMT
 last modified=Feb 21, 2007 15:34:25 GMT
 events last modified=Dec 17, 2007 15:31:51 GMT
 todos last modified=Feb 21, 2007 15:20:18 GMT
 deletelog last modified=Aug 10, 2007 11:01:58 GMT
 number of events=33
 number of tasks=0

gram-20020624:Support: owner=gram-20020624 status=enabled
 name=Travel Schedule
 description=
 other owners=
 double book=yes
 aces=@@o^c^wdeic^g;@@o^a^rsf^g;@^a^rsf^g;@^c^^g
 email=
 time zone=America/Denver
 categories=
 character set=
 language code=en
 created=Feb 21, 2007 17:14:26 GMT
 last modified=Feb 21, 2007 22:32:40 GMT
 events last modified=Dec 10, 2007 17:20:28 GMT
 todos last modified=Feb 21, 2007 17:14:26 GMT
 deletelog last modified=Nov 02, 2007 19:44:39 GMT
 number of events=142
 number of tasks=0


can someone please show me a easy way to do this, I know it there's a simple way to do this but sure not getting it to work right.

Thanks,




Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: bt707
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by ozo

Rank: Genius

Expert Comment by ozo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Adam314

Rank: Genius

Expert Comment by Adam314:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bt707
Author Comment by bt707:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bt707
Author Comment by bt707:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by ozo

Rank: Genius

Expert Comment by ozo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bt707
Author Comment by bt707:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by Adam314

Rank: Genius

Assisted Solution by Adam314:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bt707
Author Comment by bt707:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by ozo

Rank: Genius

Accepted Solution by ozo:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628