Sponsored Content
Top Forums UNIX for Dummies Questions & Answers add a line to a specfic point in a file Post 302098961 by mudhireddy on Thursday 7th of December 2006 02:17:42 PM
Old 12-07-2006
Try this AWK command, It should work

awk '{if ($1 == "#" && $2 == "Begin" && $3 == "customizations" && NF == 3) $NF=$NF"\n$AVARIABLE/dir1/dir2;export $AVARIABLE"; print }' file_name

Have fun
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: d__browne
4 Replies

2. UNIX for Dummies Questions & Answers

Delete line till certain point

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

Every nth line with different starting point

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

Add new parameters into a line, and redirect the line to other file

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

howto add line as a first line into a non empty file

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

To track any modification in a specfic file

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

Add floating point numbers from file

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

Replace and add line in file with line in another file based on matching string

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

Trying To Write File Contents To Specfic .csv Cell

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? IN AIX

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
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**31bytes). 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.10 1 Feb 1995 dircmp(1)
All times are GMT -4. The time now is 05:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy