Sponsored Content
Top Forums Shell Programming and Scripting add character to the end of each line in file Post 302337885 by edidataguy on Sunday 26th of July 2009 06:14:37 AM
Old 07-26-2009
0D=13 and 0A=10
Not as you mentioned. ***0d(=\015), 0a(=\012)***
Also they have to be in caps.

When you say you have 32 lines, that means you already have a 0A (or line feed) at the end of the lines.
Else it will be one big string.
What exactly do you need?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Deleting end of line $ character in file

Hi, I've got a file where in the middle of the record is a $ end of line character, visible only when I open the file in vi and do :set list. How to I get rid of the character in the middle and keep it at the end. The middle $ character always appears after SW, so that can be used to tag it.... (3 Replies)
Discussion started by: bwrynz1
3 Replies

2. UNIX for Dummies Questions & Answers

removing a character and addending to end in each line in a file

HI i am having a file this (sys19:pnlfct:/pfact/temp>) cat temp_sand 1234567890 1234567890 1234567890 1234567890 I want to make this file as (sys19:pnlfct:/pfact/temp>) cat temp_sand 1456789023 1456789023 1456789023 1456789023 just take the 2nd and 3rd position and put it... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

3. UNIX for Dummies Questions & Answers

How to add new line character at the end of a file

hi all, i have this question: How to add new line character at the end of a file???? i need this because i am loading a file to sybase and i have problems with the last record thanks for your help (5 Replies)
Discussion started by: DebianJ
5 Replies

4. Shell Programming and Scripting

append a character at end of each line of a file

Hi, i want to append a character '|' at end of each line of a file abc.txt. for example if the file abc.txt conatins: a|b|c 1|2|33 w|2|11 i want result file xyz.txt a|b|c| 1|2|33| w|2|11| I know this is simple but sumhow i am not able to reach end of line. its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies

5. Shell Programming and Scripting

add character to every end-of line in file

Hi All I have a file which conatins record.the length of every records is 47. problem : in the end of record i don't have a "\015" character. i want to add this "\015" charcter in the end of every record. the file contains something like 700 records. i've tried with sed command - nothing. ... (8 Replies)
Discussion started by: naamas03
8 Replies

6. Shell Programming and Scripting

How to remove new line character at end of file.

I need to remove new line character from end of file. Suppose here are content. a|b|c|d|r a|b|c|d|r a|b|c|d|r <new line> that means file contains 4 lines but data is there in 3 lines. so I want that only 3 lines should be there in file. Please help (20 Replies)
Discussion started by: varun940
20 Replies

7. Shell Programming and Scripting

How to Remove comma as last character in end of last line of file?

how to Remove comma as last charector in end of last line of file: example: input file --------------- aaaaaa, bbbbbb, cccc, 12345, ____________ output file : ----------- aaaaaa, bbbbbb, (6 Replies)
Discussion started by: RahulJoshi
6 Replies

8. Shell Programming and Scripting

How to add a character at end of line?

Hai, I have got a small requirement in my script. and i am using bash shell. I need to add a dot (.) for some particular line in a file. Say for example, $Cat rmfile 1 This is line1 2 This is line2 3 This is line3 O/p should be : $Cat rmfile 1 This is line1 2 This is line2. #... (2 Replies)
Discussion started by: Sivajee
2 Replies

9. Shell Programming and Scripting

How to add newline character at end of file?

Hi All, I have following piece of code in UNIX C Shell script and I want to add one more command which can add newline at the end of file only if there is no newline character exists. foreach file (`ls $dd_PLAYCARD_EDI_IN`) if ( -f $dd_PLAYCARD_EDI_IN/${file} ) then cat -n... (4 Replies)
Discussion started by: jnrohit2k
4 Replies

10. Shell Programming and Scripting

Conditionally add character at end of line

Hi, I would like have a shell script to check every line in a file to see if it ends with ";". If this is NOT the last character ";" should be added. MyFile.csv : web9331801;01/01/2014 23:39:35;;"93962";353150256; web9331802;01/01/2014 23:44:29;;"479288";353153538; web9331803;01/01/2014... (14 Replies)
Discussion started by: vg77
14 Replies
newform(1)						      General Commands Manual							newform(1)

NAME
newform - change or reformat a text file SYNOPSIS
[file]... DESCRIPTION
reads lines from the named files, or standard input if no input file is named, and reproduces the lines on standard output. Lines are reformatted in accordance with command line options in effect. Command line options can appear in any order, can be repeated, and can be intermingled with the optional files. Command line options are processed in the order specified. This means that option sequences such as yield results different from Options are applied to all files on the command line. Options recognizes the following options: Same as except characters are appended to the end of a line. Truncate n characters from the beginning of the line when the line length is greater than the effective line length (see The default is to truncate the number of characters necessary to obtain the effective line length. The default value is used when with no n is used. This option can be used to delete the sequence numbers from a COBOL program as follows: The must be used to set the effective line length shorter than any existing line in the file so that the option is activated. Change the prefix/append character to k. The default character for k is a space. Same as except that characters are truncated from the end of the line. Write the tab specification format line on the standard output before any other lines are output. The tab specification format line which is printed will correspond to the format specified in the option. If no option is specified, the line which is printed contains the default specification of Input tab specification: expands tabs to spaces, according to the tab specifications given. The tabspec recognizes all tab specification forms described in tabs(1). In addition, tabspec can be in which assumes that the tab specification is to be found in the first line read from the standard input (see fspec(4)). If no tabspec is given, tabspec defaults to A tabspec of expects no tabs; if any are found, they are treated as Set the effective line length to n characters. If n is not entered, defaults to 72. The default line length without the option is 80 characters. Note that tabs and backspaces are treated as single characters (use to expand tabs to spaces). Output tab specification: replaces spaces with tabs, according to the tab specifications given. The tab specifications are the same as for If no tabspec is given, tabspec defaults to A tabspec of means that no spaces will be converted to tabs on output. Prefix n characters (see to the beginning of a line when the line length is less than the effective line length. The default is to prefix the number of characters necessary to obtain the effective line length. Shear off leading characters on each line up to the first tab and place up to 8 of the sheared characters at the end of the line. If more than 8 characters (not counting the first tab) are sheared, the eighth character is replaced by a and any characters to the right of it are discarded. The first tab is always discarded. An error message and program exit occur if this option is used on a file without a tab on each line. The characters sheared off are saved internally until all other options specified are applied to that line. The characters are then added at the end of the processed line. For example, to convert a file with leading digits, one or more tabs, and text on each line, to a file beginning with the text, all tabs after the first expanded to spaces, padded with spaces out to column 72 (or truncated to column 72), and the leading digits placed starting at column 73, the command would be: RETURN VALUE
returns one of the following values: No errors encountered. An error occurred. DIAGNOSTICS
All diagnostics are fatal. was called with a bad option. There was no tab on one line. Self-explanatory. A line exceeds 512 characters after being expanded in the internal work buffer. A tab specification is incorrectly formatted, or specified tab stops are not ascending. A tabspec read from a file (or standard input) must not contain a tabspec referencing another file (or standard input). WARNINGS
normally only keeps track of physical characters; however, for the and options, keeps track of backspaces in order to line up tabs in the appropriate logical columns. does not prompt the user if a tabspec is to be read from the standard input (by use of or If the option is used, and the last option specified was and was preceded by either a or a the tab specification format line will be incor- rect. SEE ALSO
csplit(1), tabs(1), fspec(4). newform(1)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy