General :: Remove Line Breaks From Lines Ending With A Comma?

Nov 10, 2010

I have a CSV file that's created in an application that can't output lines longer than 250 characters. the data fields, all together, are longer than this. how would I remove the line break from every line that ends with a comma? For example:

A,B,C
D,E,
F
G,H,I

becomes:

A,B,C
D,E,F
G,H,I

View 1 Replies


ADVERTISEMENT

Programming :: Using Sed To Remove Line In A Comma-delimited File?

Mar 10, 2009

I have a script that output all my data in to a comma-delimited file separated by ";"

Current Output:

Quote:

"SAP 1117A";10.94.1.7;239.234.1.12;0;0;0;0;0;3;172.31.207.45;""
"";NA;239.192.1.50;0;0;0;0;0;3;172.31.207.61;""
"";NA;239.192.1.50;0;0;0;0;0;3;172.31.207.62;""

[code]...

I would like to remove all lines that have an NA in the second field.

New Output

Quote:

"SAP 1117A";10.94.1.7;239.234.1.12;0;0;0;0;0;3;172.31.207.45;""
....

View 4 Replies View Related

General :: Copy Lines Starting And Ending With Specific Pattern From Multiple Files To A File?

Jul 27, 2011

A function by name abc is called in many files. I want to copy all the lines with the function call to an output file.A simple grep on function name doesn't help me as the function call is spanning across multiple lines as follows:

abc(parameter1,
parameter2,
parameter3);

So I want to copy all the three lines (till semicolon) to the output file.The problem is because there are more than 200 calls for the same function and I cannot do it manually

View 2 Replies View Related

General :: Adding A Comma To The End Of Every Nth Line In Vi (or Sed)?

Oct 12, 2009

I have a fairly long list of data that I am trying to put into a math program (maple) but before I can do that I need to edit the format of the data such that at the end of every 25th line I add a comma. I would prefer a solution that uses vi, but if that's impossible sed would be fine also (or awk).

View 6 Replies View Related

OpenSUSE :: Web - Screen Loads And After Initial First Few Lines Breaks Up Into Multiple Repetitions Of Lines

Apr 22, 2011

I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:

[Code]...

View 1 Replies View Related

Programming :: Add Comma To End Of Lines In Text File?

Aug 21, 2010

I have a plain text file with 360 lines of varying length text. How do I add a comma or other symbol to the end of each line so that I can convert the file to csv format that I can open in a spreadsheet (45 rows, 8 columns). That means each 8 lines of text forms 8 columns, with 45 rows.

View 9 Replies View Related

Programming :: Join 5 Lines Blocks Comma Delimited?

Nov 26, 2010

I have been searching previous posts but could not find an example which works with my data. I think I might be the spaces in my fields. I have a massive data file and need to join 5 line blocks separated by a comma.

Code:

2
111.222.333.444
host.edu

[code].....

View 8 Replies View Related

General :: Vim - Get Rid Of The Line Breaks?

Sep 26, 2009

I've copied a bunch of text into vim and I need to get rid of the line breaks. I've tried

:%s/^M// (where ^M is C-v C-m)
and
:%s/.$//
and

[code]....

all lines are terminated with a '$'. How can I get rid of them?

View 3 Replies View Related

General :: Grep Lines Containing A Certain String PLUS The Line Following That Line?

Sep 1, 2009

I have a dataset (see example below) that I would like to go through and copy all lines containing a certain string ("LGIG") plus the line immediately following that line to a new file. I have no problem grepping lines containing the string LGIG but I'm lost how to translate that to line number and shift up one line number for each instance of that string.

Example input file:

[code].....

View 5 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related

OpenSUSE :: Error: Repoindex.xml[12] Opening And Ending Tag Mismatch: Meta Line 11 And Head

Apr 5, 2011

whenever I try to open my repo's I get the following error message

Code: There were errors while restoring the repository configuration.Parse error: repoindex.xml[12] Opening and ending tag mismatch: meta line 11 and head does any one know what that means...

View 9 Replies View Related

Programming :: Fortran - Automatically Find The Starting And Ending Line Of Desired Variable?

Jun 23, 2011

I am loading the file in Fortran. File looks something like this (shown below) I am interested in Velocity values and not Pressure values. Is there a way to code in Fortran which finds the staring LINE of Velocity values and ending LINE of values or I have to manually find the lines? IN this case it should return Starting line : 9 Ending line: 11

PHP Code:

[code]....

View 2 Replies View Related

General :: Need To Remove Lines With Sed

Mar 14, 2011

I have a large file and need to remove all the lines containing symbol/symbols.

For example: . , ! " # $ % & / ( ) = ? � � ' � + * � { } ] [ - _ : ; , > < (maybe more)

View 13 Replies View Related

General :: SED Or AWK - Remove Every 4 Of 5 New Lines

Aug 30, 2010

I have a file that looks like this:

1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
...
I would like to reformat it to look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
...
Is there a nifty awk/sed one-liner to do this operation?

View 6 Replies View Related

General :: Add A Line In A File Before The Last Two Lines?

Aug 2, 2010

I need to add a line in a file before the last two lines using a script using standard linux editors like sed but i can't figure it out.

View 2 Replies View Related

General :: How To Remove Over Written Lines

Apr 19, 2010

I need to filter the log from a massive wget. I want to remove the progress lines and only leave the last one. Now each progress line starts with a newline '

View 2 Replies View Related

General :: Using Sed To Remove Lines Around A Specified String?

Jun 4, 2010

I have a data set that takes the form...

0.0 43
12572.9102 80.8521 263.3575 0.0200 12.6358 -86.4942
4.3870e-06 -0.3547

[code]....

View 1 Replies View Related

General :: Remove Lines With Variable Value?

Jul 20, 2011

I have model output data in ascii format. It contains thousands of lines. The output file contains multiple text lines with variable values. here I copy-paste some of it's contents.

Code:

73438 170 23:53:20 3.481328E-03 1.824611E+04 1.824612E+04 1.333962E+16
73439 170 23:56:40 3.481210E-03 1.824611E+04 1.824612E+04 1.333962E+16
73440 171 00:00:00 3.481093E-03 1.824611E+04 1.824612E+04 1.333962E+16

[code]....

i want to remove the lines starting by WRT and DEF.

View 7 Replies View Related

General :: Remove X Lines From Output?

Oct 11, 2010

I would like to know how to remove X lines from output. i have a test file and i want the output without the first 2 lines

[root@node1 ~]# cat test
1
2
3

[code]....

View 5 Replies View Related

General :: Using Sed To Remove Lines With Duplicate ID's?

May 8, 2010

I have a file that contains lines representing the nodes of a polyline but I only need the first point in each segment. With the following text:

0,"013A",0.57,260739.891,4379258.87
0,"013A",0.57,260737.674,4379258.94
0,"013A",0.57,260684.628,4379258.35
1,"013A",0.545,260769.915,4379257.84
1,"013A",0.545,260739.891,4379258.87

[Code]....

The problem with uniq is that the last two colums will differ. I don't care about the x/y for any points following the first one.

View 4 Replies View Related

General :: Multiple Lines At The Command Line?

Feb 22, 2011

I've seen a few tutorials that have commands and parameters on multiple line, like the one below:

Code:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

I can copy and paste this in Putty, but what if I want to manually type it? If I press return, the first line gets processed, so how do I insert a new line?

View 4 Replies View Related

General :: Advance Sed To Remove Multiple Lines

May 12, 2010

I have a txt file with couple of comment lines:
Number of title = !num!
#line1
#line2
#line3

I wrote a script with "sed" to replace !num! in this file, which is very straightforward. However, based on the !num!, I want to remove the number of "#" based on the !num! value. Is there an easy way to do that with "sed"; otherwise, i will have to write a script to loop through the file.

View 8 Replies View Related

General :: Remove All Lines In A File Containing Sameword?

Aug 6, 2010

When i want to remove particular lines containing a specific word in from entire document at a time,i am using the following command.

awk '$columnno !~/specificword/' inputfile > outputfile

But here, coulmn no is my problem, because iam having this in different columns. So i need a solution for it.

How to write such removal command without mentioning column no. , ie irrespective of column no, it has to remove all lines having that specific word.

View 10 Replies View Related

General :: Finding A Script To Remove Lines Without Chars?

Dec 26, 2010

I have a text file that each contains either a domain or an IP, like this:

Code:

[me@server ~]# cat file1
122.foo.com
yahoo.com
23345229.com

[code]....

I want to remove all IPs in that file and keep others, so the result be like:

Code:

[me@server ~]# cat file2
122.foo.com
yahoo.com
23345229.com

[code]....

View 6 Replies View Related

General :: Commands To Remove Particular Few Lines In History File?

Jun 16, 2010

Is there any commands or scripts to remove only selected line in the history file.

View 1 Replies View Related

General :: Remove Lone Lines From A Text File?

Jul 6, 2011

anyone has ideas how to remove lone lines from a text file?

If I have a file that is like this:
-----------------------------------
line 1

[code]...

View 14 Replies View Related

General :: Delete Duplicate Lines Without Removing First Instance Of That Line?

Feb 7, 2011

I have a file "test.txt" with following data

#1
aaa
#2
bbb
#3
aaa
#4
ddd

I wanted it to be displayed as

#1
aaa
#2
bbb
#4
ddd

I used awk "'!x[$0]++' test.txt > file.new"
,but it deleted #1 also.I tried using uniq command but i didn't work.
Can anyone Please let me know is there any way to do this using shell script.

View 2 Replies View Related

General :: Deleting First Line With Unique String Then All Subsequent Lines Thereafter?

Jan 20, 2011

I am doing molecular dynamics where I have to edit files. I have looked at tutorials for grep and sed but can't find my solution. The files produced in my simulations look something like this:

ATOM 1825 NE2 GLN 112 113.646 27.895 14.456
ATOM 1826 HE21 GLN 112 114.020 26.957 14.490
ATOM 1827 HE22 GLN 112 112.649 28.039 14.388

[code]...

View 5 Replies View Related

General :: Shortcut To Remove First Character Of Multiple Lines In Gedit

Jan 23, 2010

I want to be able to remove the first character of a line when I highlight multiple lines in gedit. Example:

%Example is
%Commented Code
%Uncomment using this shortcut

I would then highlight/select these lines, and remove the first character to make it look like this:

Example is
Commented Code
Uncomment using this shortcut

I'm pretty sure there is an actual shortcut for this. If there is another text editor on Linux that it would work in, it would be nice to know how to do it in that editor as well.

View 2 Replies View Related

General :: Remove Lines From A Syslog Text File That Have Duplicate Strings

Mar 17, 2011

Trying to remove lines from a syslog text file that have duplicate strings

Mar 10 06:51:11[http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360]

then a few lines down

Mar 10 06:52:03 [http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360

got the same thing in terms of a u: number but the issue is I need to remove duplicates and just leave one and the file has multiple duplicates of different u: numbers and it's 14,000 lines long. can anyone tell me if I can use awk? sed? or sort for something like this to? removing lines that have a certain string in there that's a duplicate.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved