12-07-2006
add a line to a specfic point in a file
Hello,
Simple if you know how, which I don't....
I would like to add a line to file file.env
file.env consists of the following :
line 1-20 here ..
# Begin customizations
$AVARIABLE/dir1/dir2;export $AVARIABLE
# End customizations
eof
I would like to use a shell script to add the line $AVARIABLE/dir1/dir2;export $AVARIABLE, but it has to come after # Begin customizations
Any idea how to do this please ? Thanks for your time.
Cheers,
Dave
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Simple if you know how, which I don't....
I would like to add a line to file file.env
file.env consists of the following :
line 1-20 here ..
# Begin customizations
$AVARIABLE/dir1/dir2;export $AVARIABLE
# End customizations
eof
I would like to use a shell script to... (4 Replies)
Discussion started by: d__browne
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a requirement to delete a line till a certain word. Am not sure how to do it
e.g I want to delete till the bold character since start of line.
Any help is higly appretiated. (2 Replies)
Discussion started by: inq
2 Replies
3. Shell Programming and Scripting
Hi every one,
I am trying to generate different files from a column of numbers with the following format, as an example:
main file(input)
1
2
3
. ... (19 Replies)
Discussion started by: nxp
19 Replies
4. Shell Programming and Scripting
How can i add new parameters into a line, and redirect the line to other file?
For example:
1.sh
name:owner
google:richard
youtube:student
I want a, for example 2.sh with:
name:owner:description
google:richard:search site
youtube:student:video site
In the 2.sh, I added a new column:... (7 Replies)
Discussion started by: rafazz
7 Replies
5. Shell Programming and Scripting
Hi
Trying to do like this :
echo "$variable1\n $(cat file.txt)"
but it only adds one time. When I run this cmd again with different variable it only replaces line of variable1.
How to add constantly line into first line in file ? (3 Replies)
Discussion started by: presul
3 Replies
6. Shell Programming and Scripting
Hi All,
I am a pretty new to programming or scripting. Please help me in my below query.
I want to write a script which can track a file for any kind of modification and if there is any modification then it should move that file or i should say backup that file to another server.
Please... (6 Replies)
Discussion started by: makkar4u
6 Replies
7. UNIX for Dummies Questions & Answers
How do I use bash to add all the floating point numbers saved in a file like this?
490.47
244.61
263.07
131.59
246.81
115.20 (3 Replies)
Discussion started by: locoroco
3 Replies
8. Shell Programming and Scripting
Hi,
I want to achieve something similar to what described in another post:
The difference is I want to add the line if the pattern is not found.
File 1:
A123, valueA, valueB
B234, valueA, valueB
C345, valueA, valueB
D456, valueA, valueB
E567, valueA, valueB
F678, valueA, valueB
... (11 Replies)
Discussion started by: jyu3
11 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I'm attempting to write the entire contents of a file to a specific .csv cell. So far have only a nawk one liner that will write a value into a specific .csv cell. Trying to use man page but can't seem to get any farther. Any help would be appreciated. nawk -v r=2 -v c=3 -v val=5 -F,... (7 Replies)
Discussion started by: jimmyf
7 Replies
10. UNIX for Beginners Questions & Answers
How to create a new mount point with 600GB and add 350 GBexisting mount point
Best if there step that i can follow or execute before i mount or add diskspace IN AIX
Thanks (2 Replies)
Discussion started by: Thilagarajan
2 Replies
LEARN ABOUT OPENSOLARIS
dircmp
dircmp(1) User Commands dircmp(1)
NAME
dircmp - directory comparison
SYNOPSIS
dircmp [-ds] [-w n] dir1 dir2
DESCRIPTION
The dircmp command examines dir1 and dir2 and generates various tabulated information about the contents of the directories. Listings of
files that are unique to each directory are generated for all the options. If no option is entered, a list is output indicating whether the
file names common to both directories have the same contents.
OPTIONS
The following options are supported:
-d Compares the contents of files with the same name in both directories and output a list telling what must be changed in the two
files to bring them into agreement. The list format is described in diff(1).
-s Suppresses messages about identical files.
-w n Changes the width of the output line to n characters. The default width is 72.
OPERANDS
The following operands are supported:
dir1 A path name of a directory to be compared.
dir2
USAGE
See largefile(5) for the description of the behavior of dircmp when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of dircmp: LC_COLLATE, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred. (Differences in directory contents are not considered errors.)
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
SEE ALSO
cmp(1), diff(1), attributes(5), environ(5), largefile(5)
SunOS 5.11 1 Feb 1995 dircmp(1)