Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Insert a line of text on nth line of a file Post 302967449 by gotamp on Wednesday 24th of February 2016 12:36:42 AM
Old 02-24-2016
Many thanks Ravinder,

I tried this but the -i option is not working
Code:
<aspsun19:inteng03> sed -n -i 'p;3a "CHUMMA"' abc
sed: illegal option -- i

then again i tried without -i option as well just to check the change . still it does not work.
Code:
sed -n 'p;3a "CHUMMA"' abc
sed: command garbled: p;3a "CHUMMA"

may be there is a problem with the version. Sending you the whole uname output so that you can understand my machine a bit more .
Code:
 uname -a
SunOS aspsun19 5.10 Generic_150400-20 sun4u sparc SUNW,SPARC-Enterprise

many thanks - 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
HME(4)							   BSD Kernel Interfaces Manual 						    HME(4)

NAME
hme -- Sun Microelectronics STP2002-STQ Ethernet interfaces device driver SYNOPSIS
hme* at pci? dev ? function ? hme* at sbus? slot ? offset ? DESCRIPTION
The hme driver supports Sun Microelectronics STP2002-STQ Fast Ethernet interfaces. HARDWARE
The hme driver supports the on-board Ethernet interfaces of many Sun UltraSPARC workstation and server models. Cards supported by the hme driver include: Sun PCI SunSwift Adapter (``SUNW,hme'') Sun SBus SunSwift Adapter (``hme'' and ``SUNW,hme'') Sun PCI Sun100BaseT Adapter 2.0 (``SUNW,hme'') Sun SBus Sun100BaseT 2.0 (``SUNW,hme'') Sun PCI Quad FastEthernet Controller (``SUNW,qfe'') Sun SBus Quad FastEthernet Controller (``SUNW,qfe'') The STP2002 family supports hardware checksumming to assist in computing IPv4 TCP/UDP checksums. The hme driver supports this feature of the chip. See ifconfig(8) for information on how to enable this feature. SEE ALSO
ifmedia(4), intro(4), mii(4), ukphy(4), ifconfig(8) Sun Microelectronics, STP2002QFP Fast Ethernet, Parallel Port, SCSI (FEPS) User's Guide, http://mediacast.sun.com/users/Barton808/media/STP2002QFP-FEPs_UG.pdf, April 1996. HISTORY
The hme driver first appeared in NetBSD 1.5. AUTHORS
The hme driver was written by Paul Kranenburg <pk@NetBSD.org>. BUGS
Connecting a MII transceiver on those cards that support it will cause the RJ45 connector to be detected as PHY instance 1, instead of the default instance 0. BSD
June 23, 2012 BSD
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy