Sponsored Content
Top Forums Shell Programming and Scripting adding line number to *end* of records in file Post 302671525 by hergp on Friday 13th of July 2012 03:33:41 PM
Old 07-13-2012
What about using awk in this case?
Code:
awk '{ print "somestandardtext", $0 NR, "morestandardtext" }' inputfile >outputfile

---------- Post updated at 21:33 ---------- Previous update was at 21:25 ----------

And if you want to use sed, try
Code:
sed -n 'p;=' inputfile | sed 'N;s/\n//; s/^/somestandardtext /; s/$/ morestandardtext/'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding text to end of each line in a file

I'm needing to add a "hour:min" to the end of each line in a document. The document in this case is only going to be one line. if this inserts it at the end, what needs to be changed to add something at the end... /bin/echo "%s/^/$filler/g\nwq!" | ex -s $oFile Thank you... (2 Replies)
Discussion started by: cubs0729
2 Replies

2. Shell Programming and Scripting

Select matches between line number and end of file?

Hi Guys/Gals, I have a log file that is updated once every few seconds and I am looking for a way to speed up one of my scripts. Basically what I am trying to do is grep through a text file from start to finish once. Then each subsequent grep starts at the last line of the previous grep to... (4 Replies)
Discussion started by: Jerrad
4 Replies

3. Shell Programming and Scripting

Grabing Date from filename and adding to the end of each line in the file.

Hi, I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Discussion started by: rkumar28
1 Replies

4. Shell Programming and Scripting

Adding new line at the end of file

Hi I have few files. For some files the cursor is at the end of last line. For other files, cursor is at the new line at the end. I want to bring the cursor down to next line for the files that are having cursor at the end of last line In otherwords, I want to introduce a blank line at the... (5 Replies)
Discussion started by: somesh_p
5 Replies

5. Shell Programming and Scripting

Adding multiple line at the end of the file

I have 2 files which contains the following lines file1.txt line4 line5 line6 file2.txt line1 line2 line3 When i execute a script , I want my file2.txt will looks like this: line1 line2 line3 line4 line5 (2 Replies)
Discussion started by: kaibiganmi
2 Replies

6. Shell Programming and Scripting

help with sed adding line to end of file

sed '$a\ hello' books hi i am trying to use sed to append hello to the end of the file books, but for some reason i can't get it work. It keeps sayin command garbled. Anyone know what I'm doing wrong. this is in a ksh script as well. (3 Replies)
Discussion started by: bjhum33
3 Replies

7. Shell Programming and Scripting

AWK-grep from line number to the end of file

Does anyone know how to use awk to act like grep from a particular line number to the end of file? I am using Solaris 10 and I don't have any GNU products installed. Say I want to print all occurrences of red starting at line 3 to the end of file. EXAMPLE FILE: red green red red... (1 Reply)
Discussion started by: thibodc
1 Replies

8. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

9. Shell Programming and Scripting

Adding text to the end of the specific line in a file(only to the first occurrence of it)

Hi, I want to add a text to the end of the specific line in a file. Now my file looks like this: 999 111 222 333 111 444 I want to add the string " 555" to the end of the first line contaning 111. Moreover, I want to insert a newline after this line containg the "000" string. The... (8 Replies)
Discussion started by: wenclu
8 Replies

10. Shell Programming and Scripting

Help on Adding one counter loop at the end of each line in a file

Hello All, I have file a.txt I want to add a counter loop at the end of each line in a file ill explain: i have a site h**p://test.test=Elite#1 i want to add a a counter to the number at the end of the file, that it will be like this urlLink//test.test=Elite#1 urlLink//test.test=Elite#2... (3 Replies)
Discussion started by: nexsus
3 Replies
MKERRLST(1)						      General Commands Manual						       MKERRLST(1)

NAME
mkerrlst - create system error file SYNOPSIS
mkerrlst [ -i inputfile ] [ -o outputfile ] DESCRIPTION
Mkerrlst(1) creates error message files in the format described by syserrlst(5). With no arguments mkerrlst creates the file /etc/syserrlst from the internal array sys_errlist. Give just the -o option mkerrlst will create the file outputfile from the internal array sys_errlist. Given just the -i option mkerrlst will create the file /etc/syserrlst from the input file inputfile. Given both -i and -o options mkerrlst will create the error message file outputfile from the strings contained in inputfile. NOTE: error messages are numbered from 0. If the error 0 does not have a message associated with it the first string in inputfile must still be present. RETURN VALUE
mkerrlst exits with status of 0 if no errors are encountered. If errors do occur an error message is printed on stderr and the exit status is 1. ERRORS
mkerrlst(1) can encounter any of the errors for the open(2), lseek(2), read(2), or write(2) system calls. SEE ALSO
syserrlst(3) syserrlst(5) HISTORY
mkerrlst(1), first appeared in 2.11BSD. BUGS
Error messages can be a maximum of 80 characters. 3rd Berkeley Distribution March 14, 1996 MKERRLST(1)
All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy