Solved

UNIX embedded command in sed problem.

Posted on 1998-09-14
3
237 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

9 Experts available now in Live!

Get 1:1 Help Now