Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Insert a line of text on nth line of a file Post 302967446 by gotamp on Tuesday 23rd of February 2016 11:50:00 PM
Old 02-24-2016
Wrench Insert a line of text on nth line of a file

Hi All,

I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise

My intention is to insert a line of text after 13th line of every file inside a particular directory.

While trying to do it for a single file , i am using sed
Code:
sed '3 i this is the 4th line' filename
sed: command garbled: 3 i this is the 4th line

again i tried with
Code:
 sed -i '3i 4th line' filename
sed: illegal option -- i

any help would be appreciated.

Regards- Goutam
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert text file at a certain line.

I need to insert a file called temp_impact (which has about 15 lines in it) to a file called 11.23cfg starting at line 33. I searched the forums and found the sed '34i\ test' 11.23cfg > newfile That will enter word test at the appropriate line, but i need the entire file dumped there. Any... (4 Replies)
Discussion started by: insania
4 Replies

2. Shell Programming and Scripting

how to insert a extra line in a text file

how to insert a extra line in a text file using a sh command iam trying to think of a way to add a extra line but without deleting the whole text do anyone have any ideas (2 Replies)
Discussion started by: bhaviknp
2 Replies

3. Shell Programming and Scripting

Insert a line in a text file

So I need to write lines into line X of file X. I can get the file by doing: cfgnumber=$(cat -n -comm.cfg| grep -i "servicegroup_name 24x7-comunicacions") echo $cfgnumber it outputs the Line where it finds now I need to start writing something right bellow that line. thanks (10 Replies)
Discussion started by: 4scriptmoni
10 Replies

4. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

5. Shell Programming and Scripting

Using sed to insert text file at first line

sed '1r file.txt' <source.txt >desti.txt This example will insert 'file.txt' between line 1 and 2 of source.txt. sed '0r file.txt' <source.txt >desti.txt gives an error message. Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies

6. UNIX for Dummies Questions & Answers

Insert a line in a sorted text file(s)

Hello, I am trying to add a line (usually just a word) to some text files in a directory that are already sorted. I just don't want to run the sort command again because it can take a long time when the text or log files are really huge. I have a bashscript that will take in the 1st argument... (7 Replies)
Discussion started by: raptor25
7 Replies

7. Shell Programming and Scripting

How to start reading from the nth line till the last line of a file.

Hi, For my reuirement, I have to read a file from the 2nd line till the last line<EOF>. Say, I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines. for i in `cat test.txt` { echo $i } While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies

8. UNIX for Dummies Questions & Answers

Insert a line in a text file

I want to insert a line with text after the 9th line of a text file. How would I do this using sed or awk? (2 Replies)
Discussion started by: lost.identity
2 Replies

9. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
dcs(1M) 						  System Administration Commands						   dcs(1M)

NAME
dcs - domain configuration server SYNOPSIS
/usr/lib/dcs [-s sessions] [ [-a auth] [-e encr] [-u esp_auth] ] [-l] DESCRIPTION
The Domain Configuration Server (DCS) is a daemon process that runs on Sun servers that support remote Dynamic Reconfiguration (DR) clients. It is started by the Service Management Facility (see smf(5)) when the first DR request is received from a client connecting to the network service sun-dr. After the DCS accepts a DR request, it uses the libcfgadm(3LIB) interface to execute the DR operation. After the operation is performed, the results are returned to the client. The DCS listens on the network service labeled sun-dr. Its underlying protocol is TCP. It is invoked as a server program by the SMF using the TCP transport. The fault management resource identifier (FMRI) for DCS is: svc:/platform/sun4u/dcs:default If you disable this service, DR operations initiated from a remote host fail. There is no negative impact on the server. Security for the DCS connection is provided differently based upon the architecture of the system. The SMF specifies the correct options when invoking the DCS daemon, based upon the current architecture. For all architectures, security is provided on a per-connection basis. The DCS daemon has no security options that are applicable when used on a Sun Enterprise 10000 system. So there are no options applicable to that architecture. The security options for Sun Fire high-end systems are based on IPsec options defined as SMF properties. These options include the -a auth, -e encr, and -u esp_auth options, and can be set using the svccfg(1M) command. These options must match the IPsec policies defined for DCS on the system controller. Refer to the kmd(1M) man page in the System Management Services (SMS) Reference Manual. The kmd(1M) man page is not part of the SunOS man page collection. Security on SPARC Enterprise Servers is not configurable. The DCS daemon uses a platform-specific library to configure its security options when running on such systems. The -l option is provided by the SMF when invoking the DCS daemon on SPARC Enterprise Servers. No other secu- rity options to the DCS daemon should be used on SPARC Enterprise Servers. OPTIONS
The following options are supported: -a auth Controls the IPsec Authentication Header (AH) algorithm. auth can be one of none, md5, or sha1. -e encr Controls the IPsec Encapsulating Security Payload (ESP) encryption algorithm. encr can be one of none, des, or 3des. -l Enables the use of platform-specific security options on SPARC Enterprise Servers. -s sessions Sets the number of active sessions that the DCS allows at any one time. When the limit is reached, the DCS stops accepting connections until active sessions complete the execution of their DR operation. If this option is not specified, a default value of 128 is used. -u esp_auth Controls the IPsec Encapsulating Security Payload (ESP) authentication algorithm. esp_auth can be one of none, md5, or sha1. EXAMPLES
Example 1 Setting an IPSec Option The following command sets the Authentication Header algorithm for the DCS daemon to use the HMAC-MD5 authentication algorithm. These set- tings are only applicable for using the DCS daemon on a Sun Fire high-end system. # svccfg -s svc:/platform/sun4u/dcs setprop dcs/ah_auth = "md5" # svccfg -s svc:/platform/sun4u/dcs setprop dcs/esp_encr = "none" # svccfg -s svc:/platform/sun4u/dcs setprop dcs/esp_auth = "none" # svcadm refresh svc:/platform/sun4u/dcs ERRORS
The DCS uses syslog(3C) to report status and error messages. All of the messages are logged with the LOG_DAEMON facility. Error messages are logged with the LOG_ERR and LOG_NOTICE priorities, and informational messages are logged with the LOG_INFO priority. The default entries in the /etc/syslog.conf file log all of the DCS error messages to the /var/adm/messages log. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWdcsu, SUNWdcsr | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
svcs(1), cfgadm_sbd(1M), svcadm(1M), svccfg(1M), syslog(3C), config_admin(3CFGADM), libcfgadm(3LIB), syslog.conf(4), attributes(5), smf(5), dr(7D) NOTES
The dcs service is managed by the service management facility, smf(5), under the fault management resource identifier (FMRI): svc:/platform/sun4u/dcs:default Administrative actions on this service, such as enabling, disabling, or requesting restart, can be performed using svcadm(1M). The ser- vice's status can be queried using the svcs(1) command. SunOS 5.11 25 Apr 2006 dcs(1M)
All times are GMT -4. The time now is 08:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy