Sponsored Content
Top Forums Shell Programming and Scripting Using sed to insert text file at first line Post 302508762 by ctsgnb on Tuesday 29th of March 2011 03:44:49 AM
Old 03-29-2011
H appen newline + patternspace into the hold space
h would replace instead of appen
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED- Insert text at top of file

Does anyone know how to insert text at the top and bottom of a file using sed? (12 Replies)
Discussion started by: MBGPS
12 Replies

2. 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

3. 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

4. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

5. Shell Programming and Scripting

sed insert text at particular line

I know that sed -n '12p' file will print line 12 but how might I insert text to a specified line? thanks (2 Replies)
Discussion started by: action_owl
2 Replies

6. Shell Programming and Scripting

Insert text file only after the first match with SED

Hello, I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml... (1 Reply)
Discussion started by: PhoenixONE
1 Replies

7. Shell Programming and Scripting

Sed insert text at first line of empty file

I can't seem to get sed to allow me to insert text in the first line of an empty file. I have a file.txt that is a 0 byte file. I want sed to insert " fooBar" onto the first line. I've tried a few options and nothing seems to work. They work just fine if there's text in the file tho. Help? (4 Replies)
Discussion started by: DC Slick
4 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. UNIX for Beginners Questions & Answers

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 sed '3 i this is the 4th line' filename sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies
me(5)                                                   Standards, Environments, and Macros                                                  me(5)

NAME
me - macros for formatting papers SYNOPSIS
nroff -me [options] filename... troff -me [options] filename... DESCRIPTION
This package of nroff and troff macro definitions provides a canned formatting facility for technical papers in various formats. When pro- ducing 2-column output on a terminal, filter the output through col(1). The macro requests are defined below. Many nroff and troff requests are unsafe in conjunction with this package, however, these requests may be used with impunity after the first .pp: .bp begin new page .br break output line here .sp n insert n spacing lines .ls n (line spacing) n=1 single, n=2 double space .na no alignment of right margin .ce n center next n lines .ul n underline next n lines .sz +n add n to point size Output of the eqn(1), neqn(1), refer(1), and tbl(1) preprocessors for equations and tables is acceptable as input. REQUESTS
In the following list, "initialization" refers to the first .pp, .lp, .ip, .np, .sh, or .uh macro. This list is incomplete. Request Initial Cause Explanation Value Break .(c - yes Begin centered block. .(d - no Begin delayed text. .(f - no Begin footnote. .(l - yes Begin list. .(q - yes Begin major quote. .(xx - no Begin indexed item in index x. .(z - no Begin floating keep. .)c - yes End centered block. .)d - yes End delayed text. .)f - yes End footnote. .)l - yes End list. .)q - yes End major quote. .)x - yes End index item. .)z - yes End floating keep. .++ m H - no Define paper section. m defines the part of the paper, and can be C (chapter), A (appen- dix), P (preliminary, for instance, abstract, table of contents, etc.), B (bibliography), RC (chapters renumbered from page one each chapter), or RA (appendix renum- bered from page one). .+c T - yes Begin chapter (or appendix, etc., as set by .++). T is the chapter title. .1c 1 yes One column format on a new page. .2c 1 yes Two column format. .EN - yes Space after equation produced by eqn or neqn. .EQ x y - yes Precede equation; break out and add space. Equation number is y. The optional argument x may be I to indent equation (default), L to left-adjust the equation, or C to center the equation. .GE - yes End gremlin picture. .GS - yes Begin gremlin picture. .PE - yes End pic picture. .PS - yes Begin pic picture. .TE - yes End table. .TH - yes End heading section of table. .TS x - yes Begin table; if x is H table has repeated heading. .ac A N - no Set up for ACM style output. A is the Author's name(s), N is the total number of pages. Must be given before the first initialization. .b x no no Print x in boldface; if no argument switch to boldface. .ba +n 0 yes Augments the base indent by n. This indent is used to set the indent on regular text (like paragraphs). .bc no yes Begin new column. .bi x no no Print x in bold italics (nofill only). .bu - yes Begin bulleted paragraph. .bx x no no Print x in a box (nofill only). .ef 'x'y'z ''''' no Set even footer to x y z. .eh 'x'y'z ''''' no Set even header to x y z. .fo 'x'y'z ''''' no Set footer to x y z. .hx - no Suppress headers and footers on next page. .he 'x'y'z ''''' no Set header to x y z. .hl - yes Draw a horizontal line. .i x no no Italicize x; if x missing, italic text follows. .ip x y no yes Start indented paragraph, with hanging tag x. Indentation is y ens (default 5). .lp yes yes Start left-blocked paragraph. .lo - no Read in a file of local macros of the form .*x. Must be given before initialization. .np 1 yes Start numbered paragraph. .of 'x'y'z ''''' no Set odd footer to x y z. .oh 'x'y'z ''''' no Set odd header to x y z. .pd - yes Print delayed text. .pp no yes Begin paragraph. First line indented. .r yes no Roman text follows. .re - no Reset tabs to default values. .sc no no Read in a file of special charac- ters and diacritical marks. Must be given before initialization. .sh n x - yes Section head follows, font automatically bold. n is level of section, x is title of section. .sk no no Leave the next page blank. Only one page is remembered ahead. .sm x - no Set x in a smaller pointsize. .sz +n 10p no Augment the point size by n points. .th no no Produce the paper in thesis format. Must be given before initializa- tion. .tp no yes Begin title page. .u x - no Underline argument (even in troff). (Nofill only). .uh - yes Like .sh but unnumbered. .xp x - no Print index x. FILES
/usr/share/lib/tmac/e /usr/share/lib/tmac/*.me SEE ALSO
col(1), eqn(1), nroff(1), refer(1), tbl(1), troff(1) SunOS 5.10 25 Feb 1992 me(5)
All times are GMT -4. The time now is 12:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy