Solved

UNIX embedded command in sed problem.

Posted on 1998-09-14
3
238 Views
Last Modified: 2013-12-26
I have a problem with trying to embed a command inside of a sed command. I wish to do something like this...
     sed '/cut -c29-36 < textfile/!d' infile outfile | sed...
The problem lies in getting a database name into the sed without piping it to it and without the text coming from the standard infile for sed. I have tried quotations, graves marks, etc. Have approached the SAs with the problem, but they are too busy, or don't know. Probly don't know. I would appreciate any input on this problem, including ways around it. A diff command will not work for me here due to the very similar names of the DBs. If you need more info on the problem, email me@ jpe719@aol.com
0
Comment
Question by:jpe719
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1293211
could you please explain more detailed what the first sed in the
pipe should do, and what the second.
Where in your listed command is the database name?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1293212
Also, some shells require escaping \! inside of ''
0
 
LVL 1

Accepted Solution

by:
ksb earned 200 total points
ID: 1293213
You mean you have a file that you can snip a name from with cut:
   TARGET=`cut -c29-36 < textfile`
then you want to delete lines from "infile" that contain that
target name:
   grep -v "$TARGET" <infile ...

Sed is a Great Tool  (I wrote a calculator in it).. but you do
not need it here.

--
ksb
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now