Advertisement

07.01.2008 at 06:43AM PDT, ID: 23530082
[x]
Attachment Details

Search a pattren and delete all lines before the match

Asked by arvind in Bourne-Again Shell (bash)

I need to find out the files name by:

ls -ltr ../data | more
-rw-r--r--  1 prod prod  12219 Jun 27 00:01 CDR_20080627000129_711
-rw-r--r--  1 prod prod  11720 Jun 27 00:03 CDR_20080627000332_1
-rw-r--r--  1 prod prod  12746 Jun 27 00:05 CDR_20080627000532_2
-rw-r--r--  1 prod prod  10937 Jun 27 00:07 CDR_20080627000733_3
-rw-r--r--  1 prod prod  13349 Jun 27 00:09 CDR_20080627000933_4
-rw-r--r--  1 prod prod  13196 Jun 27 00:11 CDR_20080627001134_5
-rw-r--r--  1 prod prod  12833 Jun 27 00:13 CDR_20080627001332_6

So my serch pattern is CDR_20080627000129_711 (2008 06 27)
This pattren I need to search in a Backup file :

sed -n '/CDR_20080627000129_711/p' alreadycopiedCDR.txt
CDR_20080627000129_711

I would like to delete all the lines before this Pattren from alreadycopiedCDR.txt

please let me know if any other information required



Start Free Trial
[+][-]07.01.2008 at 06:51AM PDT, ID: 21907771

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:36AM PDT, ID: 21909333

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:36AM PDT, ID: 21909341

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2008 at 12:12AM PDT, ID: 21914115

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.02.2008 at 12:23AM PDT, ID: 21914156

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Bourne-Again Shell (bash)
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628