Sponsored Content
Top Forums Shell Programming and Scripting Insert 2 lines in a file at a specific location Post 302193225 by fpmurphy on Thursday 8th of May 2008 07:38:58 PM
Old 05-08-2008
The following ed(1) script should do the job for you. You can invoke it as follows: ed file < edscript
Code:
 /^ULIMIT_MAX_FILES
a
LD_LIBRARY_PATH='$LD_LIBRARY_PATH:$APACHE_HOME/modules'
DOWNLOADMODULE_CONF_PATHNAME='$APACHE_HOME/conf/DWLModule.cfg'
.
w
q

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert lines at specific location in file

Hi There I have this file that I would like to add entries to, however, there is a "}" as the last line that I need to keep. Basically i would like to know how I can write a script that will add new lines at the second to last line position (ie always add new line above the close bracket) ... (17 Replies)
Discussion started by: hcclnoodles
17 Replies

2. Shell Programming and Scripting

Remove duplicates from File from specific location

How can i remove the duplicate lines from a file, for example sample123456Sample testing123456testing XXXXX131323XXXXX YYYYY423432YYYYY fsdfdsf123456gsdfdsd all the duplicates from column 6-12 , must be deleted. I want to consider the first row, if same comes in the given range i want to... (1 Reply)
Discussion started by: gopikgunda
1 Replies

3. Shell Programming and Scripting

insert data into specific lines of a CSV

So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from. I then have to input the part... (4 Replies)
Discussion started by: tlarkin
4 Replies

4. Shell Programming and Scripting

how to Insert values in multiple lines(records) within a pipe delimited text file in specific cols

this is Korn shell unix. The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns... (4 Replies)
Discussion started by: vasan2815
4 Replies

5. Shell Programming and Scripting

Insert text line to specific location CSV

In Perl. ***edited question below*** Hey all, I am teaching myself some simple CSV file manipulation and have become a little stuck. Say I have the following layout in the CSV file: age,name,locationIs it possible to INSERT data into the CSV into the correct age order. For example, if I had... (1 Reply)
Discussion started by: whyte_rhyno
1 Replies

6. Shell Programming and Scripting

Insert charactera in 1st position of specific lines using vi editor or sed command

Dear all, i am having text file like below surya rama ranga laxman rajesh reddy i want add string (OK) before a text from line 3 to 5 the result will be surya rama OK ranga OK laxman OK rajesh reddy (1 Reply)
Discussion started by: suryanarayana
1 Replies

7. Shell Programming and Scripting

Deleting lines in a fixed length file where there is a word at specific location

I have a big file having 100 K lines. I have to read each line and see at 356 character position whethere there is a word "W" in it. If it is their then don't delete the line otherwise delete it. There are two lines as one Header and one trailer which should remain same. Can somebody... (5 Replies)
Discussion started by: mohit kanoongo
5 Replies

8. Shell Programming and Scripting

Find and Copy file of specific location

Dear All, I need to transfer all files present in one location to another but those files should be of specific extension like. Find and copy all files of extension .xls, .pdf, .txt from location usr/tmp to location /per/Treat (6 Replies)
Discussion started by: yadavricky
6 Replies

9. Shell Programming and Scripting

Insert character at specific location in a each line of the file

Hi All, I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script for file in /home/test/bharat/*.RET do # Process file echo "File Name=" $file #l_fileName="${file##*/}" ... (19 Replies)
Discussion started by: bharath561989
19 Replies

10. UNIX for Beginners Questions & Answers

Possible to insert a few lines of code into a file at a specific point?

Hi Folks - How would I go about inserting a chunk of lines (3) into a specific portion of a file? The background is I have a script (non shell) that it executed daily, however on Sundays, I uncomment a section of code so that piece can be run as well. So I was hoping to write a piece of... (9 Replies)
Discussion started by: SIMMS7400
9 Replies
ENVIRONMENT.D(5)						   environment.d						  ENVIRONMENT.D(5)

NAME
environment.d - Definition of user session environment SYNOPSIS
~/.config/environment.d/*.conf /etc/environment.d/*.conf /run/environment.d/*.conf /usr/lib/environment.d/*.conf /etc/environment DESCRIPTION
The environment.d directories contain a list of "global" environment variable assignments for the user environment. systemd-environment-d- generator(8) parses them and updates the environment exported by the systemd user instance to the services it starts. It is recommended to use numerical prefixes for file names to simplify ordering. For backwards compatibility, a symlink to /etc/environment is installed, so this file is also parsed. CONFIGURATION DIRECTORIES AND PRECEDENCE
Configuration files are read from directories in /etc/, /run/, and /lib/, in order of precedence. Each configuration file in these configuration directories shall be named in the style of filename.conf. Files in /etc/ override files with the same name in /run/ and /lib/. Files in /run/ override files with the same name in /lib/. Packages should install their configuration files in /lib/. Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages. All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same option, the entry in the file with the lexicographically latest name will take precedence. It is recommended to prefix all filenames with a two-digit number and a dash, to simplify the ordering of the files. If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to /dev/null in the configuration directory in /etc/, with the same filename as the vendor configuration file. If the vendor configuration file is included in the initrd image, the image has to be regenerated. CONFIGURATION FORMAT
The configuration files contain a list of "KEY=VALUE" environment variable assignments, separated by newlines. The right hand side of these assignments may reference previously defined environment variables, using the "${OTHER_KEY}" and "$OTHER_KEY" format. It is also possible to use "${FOO:-DEFAULT_VALUE}" to expand in the same way as "${FOO}" unless the expansion would be empty, in which case it expands to DEFAULT_VALUE, and use "${FOO:+ALTERNATE_VALUE}" to expand to ALTERNATE_VALUE as long as "${FOO}" would have expanded to a non-empty value. No other elements of shell syntax are supported. Each KEY must be a valid variable name. Empty lines and lines beginning with the comment character "#" are ignored. Example Example 1. Setup environment to allow access to a program installed in /opt/foo /etc/environment.d/60-foo.conf: FOO_DEBUG=force-software-gl,log-verbose PATH=/opt/foo/bin:$PATH LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} SEE ALSO
systemd(1), systemd-environment-d-generator(8), systemd.environment-generator(7) systemd 237 ENVIRONMENT.D(5)
All times are GMT -4. The time now is 02:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy