Sponsored Content
Top Forums Shell Programming and Scripting How to remove line break character in a file Post 302514478 by ctsgnb on Friday 15th of April 2011 08:31:54 PM
Old 04-15-2011
Code:
$ cat tst
Bulgaria,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Bulgaria,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Romania,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Romania,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Serbia,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie

Code:
$ awk '/Bulgaria|Romania/{x=$0;getline;sub($0,x $0)}1' tst
Bulgaria,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza",,4002,,3/11/2009,3/11/2009,Christie,Christie
Bulgaria,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Croatia,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie
Romania,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza",,4002,,3/11/2009,3/11/2009,Christie,Christie
Romania,CC,MallPlovdiv,Plovdiv,CCBPLO,2,CCBPLO2,"8 Perushtitza",,4002,,3/11/2009,3/11/2009,Christie,Christie
Serbia,CC,MallPlovdiv,Plovdiv,CCBPLO,1,CCBPLO1,"8 Perushtitza
",,4002,,3/11/2009,3/11/2009,Christie,Christie

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Line Break

Dear all, Please advise what approach can remove all line break from a text file? e.g. Source file: A B C Target file: A, B, C Thanks, Rock (5 Replies)
Discussion started by: Rock
5 Replies

2. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

3. Shell Programming and Scripting

How to remove line break in a csv file

Hi Experts, My requirement is to read the csv file and need to remove if any line break in it. sample data: Row1: "Oslo, Symra kino",Oslo,130-7,Symra 1,130-7-91 Row2:"Tønsberg, Brygga Kino SF",Tønsberg,202-1, Tønsberg SF 4,202-1-4 Expected data: Row1: "Oslo, Symra... (6 Replies)
Discussion started by: cnraja
6 Replies

4. Shell Programming and Scripting

Help to remove line break

My requirement is to read the csv file and need to remove if any line break in it. sample data: Row1: "Oslo, Symra kino",Oslo,130-7,Symra 1,130-7-91Row2:"Tønsberg, Brygga Kino SF",Tønsberg,202-1.Tønsberg SF 4,202-1-4 Expected data: Row1: "Oslo, Symra kino",Oslo,130-7,Symra... (4 Replies)
Discussion started by: cnraja
4 Replies

5. UNIX for Dummies Questions & Answers

Remove Line Break VI

I'm trying to make a script that says echo This is the date: I did this echo This is the date: date and it worked. But I need them both on the same line. And putting date on the echo line doesn't work. Is there a way to do so? (1 Reply)
Discussion started by: bbowers
1 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

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

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. Shell Programming and Scripting

Remove line break at specific position

Hi, I need to remove line breaks from a file, but only the ones at specific position. Input file: this is ok this line is divided at posit ion 30. The same as this one, also position 30 the rest of lines are ok with different lengths The longest ones are always s plitted at same... (15 Replies)
Discussion started by: qranumo
15 Replies
LQR_CARVER_GET_IMAGE_TYPE				     LqR library API reference					 LQR_CARVER_GET_IMAGE_TYPE

NAME
lqr_carver_get_image_type - get the image type of a LqrCarver object SYNOPSIS
#include <lqr.h> LqrImageType lqr_carver_get_image_type(LqrCarver* carver); DESCRIPTION
The function lqr_carver_get_image_type returns the image type (i.e. colour model) of the image contained in the LqrCarver object pointed to by carver. SEE ALSO
LqrImageType(3), lqr_carver_new(3), lqr_carver_set_image_type(3), lqr_carver_get_width(3), lqr_carver_get_height(3), lqr_carver_get_ref_width(3), lqr_carver_get_ref_height(3), lqr_carver_get_channels(3), lqr_carver_get_col_depth(3), lqr_carver_get_enl_step(3), lqr_carver_get_orientation(3) COPYRIGHT
Copyright (C) 2007-2009 Carlo Baldassi LqR library 0.4.1 API (3:1:3) 10 Maj 2009 LQR_CARVER_GET_IMAGE_TYPE
All times are GMT -4. The time now is 07:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy