Sponsored Content
Top Forums UNIX for Advanced & Expert Users Add a line to a specific spot in a file Post 302098866 by d__browne on Thursday 7th of December 2006 06:31:34 AM
Old 12-07-2006
Hi Anbu23 and thanks again

so do I have to put a \ in front of $ . ; = , etc ?? I presume this means ignore the fact that it is there and carry on

I have been trying what is below and I get the garbled message again ..

sed "/# Begin customizations/s//&\\
X_TOP=\$A_TOP\/xx\/11.5.0;export X_TOP" a.env > a.tmp

I also tried this and got the same message

sed "/# Begin customizations/s//&\\
X_TOP\=\$A_TOP\/xx\/11\.5\.0\;export X_TOP" a.env > a.tmp

What am I doing wrong please ?

Thanks again.
Dave
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to add a line after a specific line

hi I want to add a line just after a specific line can you please help? thx (2 Replies)
Discussion started by: melanie_pfefer
2 Replies

2. Shell Programming and Scripting

how to Add word at specific location in line

eg . i have file x.txt contains : java coding , shell scriptting etc... now i want to add "is langauge" after word java. output should be java is langauge coding , shell scriptting etc... any idea how to use shell script to do it ? (10 Replies)
Discussion started by: crackthehit007
10 Replies

3. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

4. Shell Programming and Scripting

Add sth to end of each line, but only for specific files

Hi. I have a list with files, and I would like to add a variable to the end of each line of each file in this list. The files are in a folder together with a large number of other files which I don't want to change. My code is: for file in 'cat ../list' do sed 's/$/\/R:_0/' $file >>... (4 Replies)
Discussion started by: Bloomy
4 Replies

5. Shell Programming and Scripting

Add new line before specific character

hello all, I have file like this "infile.txt" (all data in one line) A240 582247.99974288.7 8.0 239 582248.19974301.1 8.0 238 582248.39974313.6 8.01A 237 582248.49974326.1 8.0 236 582248.69974338.6 8.0 235 582248.79974351.1 8.01A 234 582248.99974363.5 8.0 233 582249.19974376.0 8.0 232... (4 Replies)
Discussion started by: attila
4 Replies

6. Shell Programming and Scripting

Add markup tag and sequential number after specific line

Hello, This one has me a bit stumped. I have data the looks like, M END > <PREDICTION_ACCURACY> PROBABLE > <NO_OF_PARENTS> 3 > <CLOGP> -13.373 > <SMILES> OCC(O)C(OC1OC(CO)C(OC2OC(CO)C > <MIMW> 1006.322419888 (3 Replies)
Discussion started by: LMHmedchem
3 Replies

7. Shell Programming and Scripting

To add a new line with specific text after the pattern is found using sed

hi guys, im trying to add the following line in my xml file <dbrollbacksegs <oa_var="s_db_rollback_segs">NOROLLBACK</dbrollbacksegs> when ever i find the following line <dbsharedpool oa_var="s_dbsharedpool_size">300000000</dbsharedpool> I have succedded till adding a new line... (1 Reply)
Discussion started by: smarlaku
1 Replies

8. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

9. Shell Programming and Scripting

Add specific string to last field of each line in perl based on value

I am trying to add a condition to the below perl that will capture the GTtag and place a specific string in the last field of each line. The problem is that the GT value used is not right after the tag rather it is a few fields away. The values should always be 0/1 or 1/2 and are in bold in the... (12 Replies)
Discussion started by: cmccabe
12 Replies

10. Shell Programming and Scripting

awk to update specific value in file with match and add +1 to specific digit

I am trying to use awk to match the NM_ in file with $1 of id which is tab-delimited. The NM_ will always be in the line of file that starts with > and be after the second _. When there is a match between each NM_ and id, then the value of $2 in id is substituted or used to update the NM_. Each NM_... (3 Replies)
Discussion started by: cmccabe
3 Replies
PRINTENV(1)						    BSD General Commands Manual 					       PRINTENV(1)

NAME
printenv, env -- print out the environment, set and print environment SYNOPSIS
printenv [name] env [-i] [name=value ...] [utility [argument ...]] DESCRIPTION
The printenv utility prints out the names and values of the variables in the environment, with one name/value pair per line. If name is specified, only its value is printed. Some shells may provide a builtin printenv command which is similar or identical to this utility. Consult the builtin(1) manual page. The env utility executes utility after modifying the environment as specified on the command line. The option name=value specifies an envi- ronment variable, name, with a value of value. The options are as follows: -i Execute the utility with only those environment values specified. The environment inherited by env is ignored completely. If no utility is specified, env prints out the names and values of the variables in the environment, with one name/value pair per line. The env utility is sometimes useful with the ``#!'' construct (see execve(2)). The only difference between ``#!/usr/local/bin/foo'' and ``#!/usr/bin/env /usr/local/bin/foo'' is that the latter works even if /usr/local/bin/foo is itself interpreted. Using env this way also allows one to reference foo without the path, as well as set up the environment as desired. ENVIRONMENT
The env utility uses the PATH environment variable is used to locate the requested utility if the name contains no '/' characters. DIAGNOSTICS
The printenv utility exits 0 on success, and >0 if an error occurs. The env utility exits 0 on success, and >0 if an error occurs. An exit status of 126 indicates utility was found, but could not be executed. An exit status of 127 indicates utility could not be found. COMPATIBILITY
The env utility accepts the - option as a synonym for -i. SEE ALSO
csh(1), sh(1), execvp(3), environ(7) STANDARDS
The env utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The printenv command appeared in 3.0BSD. BUGS
The env utility doesn't handle utility arguments with equal (``='') signs in their names, for obvious reasons. BSD
June 6, 1993 BSD
All times are GMT -4. The time now is 05:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy