Sponsored Content
Top Forums Shell Programming and Scripting add carriage return at end of file Post 302146201 by HAA on Monday 19th of November 2007 10:29:33 AM
Old 11-19-2007
add carriage return at end of file

Hi I would like to add carriage return at end of file,
because we need to mask the customer names for detailed records.

Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use

---aa.txt-----
1|aaa|bbb|ccc
2|bbbb|hghgh|ggg
000002

tail -1 aa.txt

2|bbbb|hghgh|ggg
000002

how can i add carriage return at end of line?

Thanks for your advise in advance

Regards,
Haa
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return. ie i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME. Any ideas are appreciated! ... (3 Replies)
Discussion started by: Shakey21
3 Replies

2. UNIX for Dummies Questions & Answers

Removing carriage return characters from file

Hello there, I need to remove carriage return characters (\n and \r) from any input file specified. This is what I am doing right now: - dumping the file to octal format using the command 'od -c file_name - removing and \s and \n characters using sed commands What I need to do now is... (3 Replies)
Discussion started by: b1saini
3 Replies

3. UNIX for Dummies Questions & Answers

Remove a carriage return at end of variable

Is there a command in unix to remove a carriage return character(^M) at the end of a variable value? (5 Replies)
Discussion started by: flagship99
5 Replies

4. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

5. UNIX for Advanced & Expert Users

Padding Carriage return to the end of XML file

Hi All, I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line. <?xml version="1.0" encoding="UTF-8"?> <ns0:iSeriesCspIntegration... (3 Replies)
Discussion started by: dasj22
3 Replies

6. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

7. Shell Programming and Scripting

Removing Carriage return in a file after particular string

Hi All, I want to remove carriage return in a file using some unix command without writing a script my file is as follows abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 I want the output as follows: abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 , Please... (7 Replies)
Discussion started by: manish8484
7 Replies

8. Shell Programming and Scripting

Need Help to delete carriage return and new line in csv file

Hi All, I have a problem loading the data from a csv file As you see below in the Input ,For the Data starting with " there are 2 lines, which i want to make them into single without changing the format of that data. You can see the desired output below: While i try to open the csv file and... (4 Replies)
Discussion started by: mlavanya
4 Replies

9. Shell Programming and Scripting

Add a carriage return after every sorted field

Hi All, I have a text file - nmn-smt-1039.test.com:SearchService-WW:x:8277 nmn-smt-1102.test.com:AdminConsole-ww:x:8536 nmn-smt-1041.test.com:SearchService-WW:x:8277 nmn-wsf-1007.test.com:Service-ww:x:8532 nmn-smt-1042.test.com:SearchService-WW:x:8277... (3 Replies)
Discussion started by: jacki
3 Replies

10. UNIX for Beginners Questions & Answers

awk Command to add Carriage Return and Line Feed

Hello, Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist ! Thanks (16 Replies)
Discussion started by: rosebud123
16 Replies
fconfigure(n)						       Tcl Built-In Commands						     fconfigure(n)

__________________________________________________________________________________________________________________________________________________

NAME
fconfigure - Set and get options on a channel SYNOPSIS
fconfigure channelId fconfigure channelId name fconfigure channelId name value ?name value ...? _________________________________________________________________ DESCRIPTION
The fconfigure command sets and retrieves options for channels. ChannelId identifies the channel for which to set or query an option. If no name or value arguments are supplied, the command returns a list containing alternating option names and values for the channel. If name is supplied but no value then the command returns the current value of the given option. If one or more pairs of name and value are supplied, the command sets each of the named options to the corresponding value; in this case the return value is an empty string. The options described below are supported for all channels. In addition, each channel type may add options that only it supports. See the manual entry for the command that creates each type of channels for the options that that specific type of channel supports. For example, see the manual entry for the socket command for its additional options. -blocking boolean The -blocking option determines whether I/O operations on the channel can cause the process to block indefinitely. The value of the option must be a proper boolean value. Channels are normally in blocking mode; if a channel is placed into nonblocking mode it will affect the operation of the gets, read, puts, flush, and close commands; see the documentation for those commands for details. For nonblocking mode to work correctly, the application must be using the Tcl event loop (e.g. by calling Tcl_DoOneEvent or invoking the vwait command). -buffering newValue If newValue is full then the I/O system will buffer output until its internal buffer is full or until the flush command is invoked. If newValue is line, then the I/O system will automatically flush output for the channel whenever a newline character is output. If newValue is none, the I/O system will flush automatically after every output operation. The default is for -buffering to be set to full except for channels that connect to terminal-like devices; for these channels the initial setting is line. Additionally, stdin and stdout are intially set to line, and stderr is set to none. -buffersize newSize Newvalue must be an integer; its value is used to set the size of buffers, in bytes, subsequently allocated for this channel to store input or output. Newvalue must be between ten and one million, allowing buffers of ten to one million bytes in size. -encoding name | This option is used to specify the encoding of the channel, so that the data can be converted to and from Unicode for use in Tcl. | For instance, in order for Tcl to read characters from a Japanese file in shiftjis and properly process and display the contents, | the encoding would be set to shiftjis. Thereafter, when reading from the channel, the bytes in the Japanese file would be converted | to Unicode as they are read. Writing is also supported - as Tcl strings are written to the channel they will automatically be con- | verted to the specified encoding on output. | If a file contains pure binary data (for instance, a JPEG image), the encoding for the channel should be configured to be binary. | Tcl will then assign no interpretation to the data in the file and simply read or write raw bytes. The Tcl binary command can be | used to manipulate this byte-oriented data. | The default encoding for newly opened channels is the same platform- and locale-dependent system encoding used for interfacing with | the operating system. | -eofchar char -eofchar {inChar outChar} This option supports DOS file systems that use Control-z (x1a) as an end of file marker. If char is not an empty string, then this character signals end-of-file when it is encountered during input. For output, the end-of-file character is output when the channel is closed. If char is the empty string, then there is no special end of file character marker. For read-write channels, a two-ele- ment list specifies the end of file marker for input and output, respectively. As a convenience, when setting the end-of-file char- acter for a read-write channel you can specify a single value that will apply to both reading and writing. When querying the end- of-file character of a read-write channel, a two-element list will always be returned. The default value for -eofchar is the empty string in all cases except for files under Windows. In that case the -eofchar is Control-z (x1a) for reading and the empty string for writing. -translation mode -translation {inMode outMode} In Tcl scripts the end of a line is always represented using a single newline character ( ). However, in actual files and devices the end of a line may be represented differently on different platforms, or even for different devices on the same platform. For example, under UNIX newlines are used in files, whereas carriage-return-linefeed sequences are normally used in network connections. On input (i.e., with gets and read) the Tcl I/O system automatically translates the external end-of-line representation into newline characters. Upon output (i.e., with puts), the I/O system translates newlines to the external end-of-line representation. The default translation mode, auto, handles all the common cases automatically, but the -translation option provides explicit control over the end of line translations. The value associated with -translation is a single item for read-only and write-only channels. The value is a two-element list for read-write channels; the read translation mode is the first element of the list, and the write translation mode is the second ele- ment. As a convenience, when setting the translation mode for a read-write channel you can specify a single value that will apply to both reading and writing. When querying the translation mode of a read-write channel, a two-element list will always be returned. The following values are currently supported: auto As the input translation mode, auto treats any of newline (lf), carriage return (cr), or carriage return followed by a new- line (crlf) as the end of line representation. The end of line representation can even change from line-to-line, and all cases are translated to a newline. As the output translation mode, auto chooses a platform specific representation; for sockets on all platforms Tcl chooses crlf, for all Unix flavors, it chooses lf, for the Macintosh platform it chooses cr and for the various flavors of Windows it chooses crlf. The default setting for -translation is auto for both input and output. binary | No end-of-line translations are performed. This is nearly identical to lf mode, except that in addition binary mode also | sets the end-of-file character to the empty string (which disables it) and sets the encoding to binary (which disables encod- | ing filtering). See the description of -eofchar and -encoding for more information. cr The end of a line in the underlying file or device is represented by a single carriage return character. As the input trans- lation mode, cr mode converts carriage returns to newline characters. As the output translation mode, cr mode translates newline characters to carriage returns. This mode is typically used on Macintosh platforms. crlf The end of a line in the underlying file or device is represented by a carriage return character followed by a linefeed char- acter. As the input translation mode, crlf mode converts carriage-return-linefeed sequences to newline characters. As the output translation mode, crlf mode translates newline characters to carriage-return-linefeed sequences. This mode is typi- cally used on Windows platforms and for network connections. lf The end of a line in the underlying file or device is represented by a single newline (linefeed) character. In this mode no translations occur during either input or output. This mode is typically used on UNIX platforms. SEE ALSO
close(n), flush(n), gets(n), puts(n), read(n), socket(n) KEYWORDS
blocking, buffering, carriage return, end of line, flushing, linemode, newline, nonblocking, platform, translation, encoding, filter, byte array, binary Tcl 8.1 fconfigure(n)
All times are GMT -4. The time now is 11:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy