sed command to substitute contents from external file
Hi All,
I am trying to substitute a line in my existing file with the set of lines from another file. Regarding the existing file, i am sure that the line i am substituting will occur only at one place.
I have stored the text to be replaced in another file.
I am using below command.
I am using cat command to get the contents from second file.
But i am getting below error
Here DSSUBRECORD is the first line from my TextToReplace.txt.
Please guide me on this error. Also please suggest on other ways to achieve this substitution requirement.
I am on a HP-UX machine I have a directory called "/u01/blobs" and the files look like this:
ls -1
7398
7399
7400
I need to produce a comma delimited file with the following format:
filename,location/filename
i.e:
7398,/u01/blobs/7398
7399,/u01/blobs/7399
7400,/u01/blobs/7400
What... (3 Replies)
Hi
I what to add option to existing sed code to convert target file to lower case
#!/bin/ksh
SOURCE_DATA_DEST=/ora
TARGET_DATA_DEST=/home/oracle/alexz
TARGET_DB_SID=T102_test
sed -e "s/REUSE/SET/g" \
-e "s/NORESETLOGS/RESETLOGS/g" \
T102_ccf.sql > target.sql
Thanks (2 Replies)
We have 2 file XML files - FILE1.XML and FILE2.xml - we need copy the contents of FILE1.XML and replace in FILE2.xml pattern "<assignedAttributeList></assignedAttributeList>"
FILE1.XML
1. <itemList>
2. <item type="Manufactured">
3. <resourceCode>431048</resourceCode>
4. ... (0 Replies)
if i want to display the contents of a file between say line number 3 and 10 then i use the following command
sed -n '3,10p' filename
if this 3 was contained in x and 10 was contained in y then how wud this command modified?
sed -n '$x,$yp' filename does not work..please advise (2 Replies)
I am trying to do what I thought should be a simple substitution, but I can't get it to work.
File:
Desire output:
I thought I'd start with a sed command to remove the part of the header line preceding the string "comp", then go on to remove the suffix of the target string (e.g. ":3-509(-)"),... (3 Replies)
Hello,
I have two files: file1 and file2
file1 has the following info:
---
host: "localhost"
port: 3000
reporter_type: "zookeeper"
zk_hosts:
- "localhost:2181"
file2 contains an IP address (1.1.1.1)
What I want to do is replace localhost with 1.1.1.1, so that the... (4 Replies)
I want to replace a string by contents of file.
I am trying the following sed command:
cat sample | sed "s^<enter description here>^`cat details`^"
But it is not working.
a=`cat details` and using $a will not help since it will affect the whitespaces.
What am I missing in the above sed... (5 Replies)
I wrote an awk script to filter "uninteresting" commands from my ~/.bash_history (I know about HISTIGNORE, but I don't want to exclude these commands from my current session's history, I just want to avoid persisting them across sessions).
The history file can contain multi-line entries with... (6 Replies)
Trying to use sed to insert the contents of a file into the end of each line in another file
file1
This is a line
Here is another line
This is yet another line
Here is a fourth line
file2
TEXT
desired output
This is a line TEXT
Here is another line TEXT
This is yet another... (6 Replies)
Discussion started by: jimmyf
6 Replies
LEARN ABOUT DEBIAN
sethead
sethead(1) General Commands Manual sethead(1)Name
sethead - Set FITS or IRAF header keyword values
Synopsis
sethead [-dknv][r letter] <FITS or IRAF file> kw1=val1 kw2=val2 ... kwn=valuen
Description
Set parameters in the header of a FITS or IRAF image. If the keywords do not already exist, they are added at the end of the header. Val-
ues are assumed to be numeric if they contain no alphabetic characters and right-aligned. Otherwise they are left-aligned after the equals
sign, and padded by spaces to a minimum of 8 characters. To set keywords in a list of files, substitute @<listfile> for the file names on
the command line. To set a lot of keywords, put them, one per line, in a file and substitute @<keylistfile> on the command line. If two @
commands are present, the program will figure out which contains file names and which contains keywords. Lines in a keyword list file
which do not contain an = are ignored.
Options-h Write HISTORY line into output header with sethead version, current date and time, and names of keywords set.
-k Write SETHEAD keyword into output header with sethead version, current date and time, and names of keywords set. If a SETHEAD key-
word already exists, move the old value to a HISTORY line before writing the new value
-n Write a new file with an added "e" before the extension.
-r letter
Rename existing keywords whose values are being reset by prepending the character "letter". Drop the last character if the changed
keyword is already 8 characters long.
-v Print confirmations of each parameter setting
Web Page
http://tdc-www.harvard.edu/software/wcstools/sethead.html
Author
Doug Mink, SAO (dmink@cfa.harvard.edu)
6 July 2001 WCSTools sethead(1)