Insert at the beginning of odd lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Insert at the beginning of odd lines
# 8  
Old 09-11-2012
Yet another sed variation:
Code:
sed 's/^/extra text /;n' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use sed to insert character in the beginning of file path?

I need to manipulate one Database file on Solaris 11 in which contains more than 5000 lines of data file path like this: '/data1/oradata/DBNAME/system01.dbf', '/data7/oradata/DBNAME/undotbs1_01.dbf', '/data1/oradata/DBNAME/sysaux01.dbf', '/data28/oradata/DBNAME/userdata01.dbf', ... (6 Replies)
Discussion started by: duke0001
6 Replies

2. UNIX for Advanced & Expert Users

Insert a column in the beginning

Hi, I have been trying to see how i can insert a column in the beginning to my html table This is how it looks Name Age Sid 32 John 33 Mary 34 I want to insert a column Job before Name column, so it looks like Job Name Age IT Sid 32 Doctor... (3 Replies)
Discussion started by: sidnow
3 Replies

3. UNIX for Dummies Questions & Answers

Replace character in odd or even lines

Hello, I'm here again asking for your precious help. I'm writing some code to convert csv files to html. I want to highlight header and also I want to have rows with alternate colors. So far this is my work###Let's format first line only with some color cat $fileIN".tmp1" | sed '1... (7 Replies)
Discussion started by: emare
7 Replies

4. Shell Programming and Scripting

Insert text at the beginning of every even number line

i am trying to insert text at the beginning of every even number line with awk i can do it with odd number lines with this command awk 'NR%2{$0="some text "$0}1' filehow can i edit this command thanks (5 Replies)
Discussion started by: bob123
5 Replies

5. Shell Programming and Scripting

Sum product of even/odd lines

Hi, I have a text file like this 6.0000E-02 0.00000E+00 0.0000 0.00000E+00 0.0000 7.0000E-02 5.00000E-10 1.0000 5.00000E-10 1.0000 8.0000E-02 3.00000E-09 0.4082 3.00000E-09 0.4082 9.0000E-02 3.50000E-09 0.3780 3.50000E-09 0.3780 1.0000E-01 1.00000E-09... (2 Replies)
Discussion started by: f_o_555
2 Replies

6. Shell Programming and Scripting

Insert output from a file to beginning of line with sed

Hi I've been trying to search but couldn't quite get the answer I was looking for. I have a a file that's like this Time, 9/1/12 0:00, 1033 0:10, 1044 ... 23:50, 1050 How do I make it so the file will be like this? 9/1/12, 0:00, 1033 9/1/12, 0:10, 1044 ... 9/1/12, 23:50, 1050 I... (4 Replies)
Discussion started by: diesel88
4 Replies

7. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

8. Shell Programming and Scripting

Need to insert text(constant) at the beginning of file

I am very new to scripting and I know this request is simple but I am having no luck with it. I have a file a.dat with the following data in it. aa bb cc dd I need to run a script that will take each line of a.dat and put dsjc/ubin/ in front of each record, so the output looks like ... (2 Replies)
Discussion started by: jclanc8
2 Replies

9. Shell Programming and Scripting

print ODD lines

i want to print ODD lines like first ,third then fifth and so on 234,567,ABC,KJL 234,565,ABD,KJL 234,568,ABE,KJL 234,560,ABF,KJL 234,563,ABG,KJL 234,562,ABH,KJL O/P will be like 234,567,ABC,KJL ----->first liine 234,568,ABE,KJL ----->third line 234,563,ABG,KJL ----->fifth line... (6 Replies)
Discussion started by: aaysa123
6 Replies

10. Shell Programming and Scripting

Insert two strings at the beginning and at the end of each line of a file

Hi, excuse me for my poor english. My problem is that: I have a File i want to add to each line of that file two strings: one at the beginning of the line, one at the ending. string1="abcd" string2="efgh" i want $string1 content $string2 for each line. Is that possible? (3 Replies)
Discussion started by: Linux-fueled
3 Replies
Login or Register to Ask a Question
STTY(1) 						      General Commands Manual							   STTY(1)

NAME
stty - set terminal options SYNOPSIS
stty [ option ... ] DESCRIPTION
Stty sets certain I/O options on the current output terminal. With no argument, it reports the current settings of the options. The option strings are selected from the following set: even allow even parity -even disallow even parity odd allow odd parity -odd disallow odd parity raw raw mode input (no erase, kill, interrupt, quit, EOT; parity bit passed back) -raw negate raw mode cooked same as `-raw' cbreak make each character available to read(2) as received; no erase and kill -cbreak make characters available to read only when newline is received -nl allow carriage return for new-line, and output CR-LF for carriage return or new-line nl accept only new-line to end lines echo echo back every character typed -echo do not echo characters lcase map upper case to lower case -lcase do not map case -tabs replace tabs by spaces when printing tabs preserve tabs ek reset erase and kill characters back to normal # and @ erase c set erase character to c. C can be of the form `^X' which is interpreted as a `control X'. kill c set kill character to c. `^X' works here also. cr0 cr1 cr2 cr3 select style of delay for carriage return (see ioctl(2)) nl0 nl1 nl2 nl3 select style of delay for linefeed tab0 tab1 tab2 tab3 select style of delay for tab ff0 ff1 select style of delay for form feed bs0 bs1 select style of delay for backspace tty33 set all modes suitable for the Teletype Corporation Model 33 terminal. tty37 set all modes suitable for the Teletype Corporation Model 37 terminal. vt05 set all modes suitable for Digital Equipment Corp. VT05 terminal tn300 set all modes suitable for a General Electric TermiNet 300 ti700 set all modes suitable for Texas Instruments 700 series terminal tek set all modes suitable for Tektronix 4014 terminal hup hang up dataphone on last close. -hup do not hang up dataphone on last close. 0 hang up phone line immediately 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 exta extb Set terminal baud rate to the number given, if possible. (These are the speeds supported by the DH-11 interface). SEE ALSO
ioctl(2), tabs(1) STTY(1)