Sponsored Content
Operating Systems HP-UX How to remove new line character and append new line character in a file? Post 302466638 by sasikari on Wednesday 27th of October 2010 12:09:44 AM
Old 10-27-2010
Hi,
Thanks a lot for the reply.

I also get the data like below ,
Code:
ID,Client ,SNo,Rank
37,Airtel 
 Private  
limited,100,999
38,Vodaphone India 
 Private Limited,200,888
39,Dell Limited,300,777
40,HP India Ltd
,400,666
41,Orange

 India 
Private 


Limited,500,555


In the last row , there are more new lines.

There are new line characters in between the lines, and so when i view the data in test pad i can see the new line characters in between, but actually it shoud be at only endof the line. (This is occuring like this, because in source data is entering in xl doc and there are multiple Alt + Enters in particular fields)

Output should be
Code:
ID,Client ,SNo,Rank
37,Airtel  Private  limited,100,999
38,Vodaphone India Private Limited,200,888
39,Dell Limited,300,777
40,HP India Ltd,400,666
41,Orange India Private Limited,500,555

Here requirement is to delete the new line characters which occur in between the every 3 commas.
Like select first 3 commas and delete the new line characters in between and then again select the next 3 commans and delete if any new line in between (Don't delete new line which is coming after 3 commas) .....like this delete till the end of the file.

Pl provide me the solution for this

Regards
Kari

Last edited by Scott; 10-28-2010 at 01:06 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using SED to append character to each line

Hey - my first post here, and I'm a total SED newb. I've looked around for previous help on this, but have so far been unsuccessful. I have a program (AMStracker for OS X) that outputs data in the terminal. Output is in this form: . . . 3 0 -75 3 0 -76 3 0 -77 ... (4 Replies)
Discussion started by: c0nn0r
4 Replies

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

3. Shell Programming and Scripting

How to append a character to the last but one field on a specific line?

Hi Guys, I have a file like this: aaa b c d e f fsss g h i k l qqq r t h n I want: aaa b c d e f fsss g h i k l qqq r t h , n ggg p t e d u qqq i o s , k (2 Replies)
Discussion started by: npatwardhan
2 Replies

4. Shell Programming and Scripting

How to remove line break character in a file

Hi, we are trying to process a csv file,in which we are getting data with line breaks.How to remove the line break character in the file? when i try to print the line break charcter using od -c,it gives as '\n' character for both line break and line feed. Please provide your valuable... (6 Replies)
Discussion started by: cnraja
6 Replies

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

6. Shell Programming and Scripting

Remove the last character (,) for every line in a file

Good afternoon: im working wih 2 files to find differences and use the cmp command cmp file1 file2 file1 file2 are are diifferent char 302 line1 i found what the difference is with the sed command and that is the file1 at the end of every line has a (,) (comma) character. i.e sed -n... (4 Replies)
Discussion started by: alexcol
4 Replies

7. Shell Programming and Scripting

Remove new line character and add space to convert into fixed width file

I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file. If the length is less than the max length, the spaces should be appended... (4 Replies)
Discussion started by: Amrutha24
4 Replies

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

9. UNIX for Dummies Questions & Answers

How to remove $ or new line character in a file?

Hi All, Could any one suggest how to remove $ symbol in a text file when i am opening in vi editor. Scenario; For example iam having a file name aaa.txt the data inside the file is like sample name when i am opening in vi editor The same file resembles like below when i am... (1 Reply)
Discussion started by: Chandru_Raj
1 Replies

10. UNIX for Beginners Questions & Answers

Append each line based upon the character size

I have a huge file which contains multiple lines. It need to check whether character length is not more than 255 each line. If its not then it should remove the character up to column. I have described in the output below. If its more than that the next line should start with call but if the... (1 Reply)
Discussion started by: JoshvaPeter
1 Replies
pmap(1) 						      General Commands Manual							   pmap(1)

NAME
pmap, pfiles - displays process address information and open file descriptors SYNOPSIS
options] pid1 [pid2...] pid1 [pid2...] DESCRIPTION
prints the address space information of a process. prints information about all open file descriptors of a process. If file descriptor corresponds to a file, then prints the fstat(2) and fcntl(2) information. If the file descriptor corresponds to a socket, then prints socket related info, such as the socket type, socket family, and protocol family. In the case of AF_INET and AF_INET6 family of sockets, information about the peer host is also printed. pmap Options The information printed by can be controlled by the option. The argument to can be a comma-separated set of arguments given below: Display the size data locked in memory for each mapped object. Display the map name. This field can contain the following data. if the object is mapped as if the object mapped is the stack segment of the process. The object mapped is the text segment of the program. The object mapped is the data segment of the program. The object is mapped from a file. If the file name cannot be resolved, then the inode number and the device ID of the file is displayed. Also see the sec- tion below. Other map names include: and Display the offset of each mapped object. Specify access permission for each mapped object. Display the resident size of each mapped object. Display the space ID of each mapped object. Display the swap allocated for each mapped object. Display the maximum size of a page that can be allocated for the object. Indicate the type of data managed by each mapped object. The values include, Shared code, with n indicating the number of processes sharing the mapped object. Private code. Shared data, with n indicating the number of processes sharing the mapped object. Private data. Display the virtual size of each mapped object. Since the name of the file can be of variable length, use the name argument as the last argument to the option to ensure proper indentation of other fields. If no option is specified, prints the following fields by default: and EXTERNAL INFLUENCES
Environment Variables If is not specified or is null, it defaults to (see lang(5)). EXAMPLES
This command prints the virtual address, the resident memory size, and the name of each object mapped for processes with process ID 100 and 200: This command prints information on open file descriptors of processes with process ID 100 and 200: WARNINGS
and depend on to resolve the file names. If the file name cannot be resolved, then these commands will only print the device ID and the inode number of the file. Users of must not rely on the exact field widths and spacing of its output, as these will vary depending on the system and the release of HP-UX. SEE ALSO
fuser(1), ps(1), vmstat(1). pmap(1)
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy