Hello, there. I have a file that's a horrible, horrible mess. (Basically, it's an export from a firewall config.) The people who generated the file didn't think that putting a newline in the middle of a hostname would ever be a problem. It is.
Here's an example of the stuff in the file:
The part with the network address I have parsed, all well and good. But the second "entity name" entry, where there's a group, you can see that it puts line breaks in random places. There's no rhyme or reason - there doesn't have to be a special character or anything, it just puts that there.
This is the string I used to get it to that point:
There's further string manipulation I do afterwards to get it into a proper comma-separated value file. But right here is the step where I need help.
I want to take every line which has commas in it, remove the line break from the end, and concatenate it with the line after. I want this only to happen on lines with commas, everything else should remain intact. I've tried everything in my limited skill set with sed, awk, perl and tr of which I could think, and I can't get it right. The closest I came was:
But that also put in a newline wherever there was a space, so it didn't help, either.
Can someone give me a little one-liner that will do this? It sounds so simple, but it has gone way beyond my meager ability at scripting.
I need to remove new lines and carriage returns from csv file.
Is there anything other than sed and gwak by which we could achieve this ? Any suggestions ? (3 Replies)
I want to list all html files present in a directory tree, the remove the newline and get one string with a space between files
find /home/chrisd/Desktop/seg/geohtml/ -name '*.html' | awk BEGIN{FS=\r} '{print}'
---------- Post updated at 06:47 PM ---------- Previous update was at 06:25 PM... (5 Replies)
Hi buddy's
my file are like this:
s.no,name,band,sal
1,"suneel",,10
2,"bargav
sand",,20
30,"
ebdug gil",,4
but i want
s.no,name,band,sal
1,"suneel",,10
2,"bargav sand",,20
30,"ebdug gil",,4
any command or Shell script for this.
please help me it's urgent to implement (33 Replies)
Hello! This is my first post here.
I have a file with text like:
A</title>
B
C</title>
D
I need to format it to:
AB
CD
I am trying to use sed: sed 's/<//title>\n/ /g' file > newfile
to delete </title> and the newline character, but the file is unchanged because there are... (3 Replies)
Hi all,
i am getting count from oracle 11g by spooling it to a file.
Now there are some newline characters and blank spaces i need to remove these.
pl provide me a awk/sed solution.
the spooled file is attached.
i tried this.. but not getting req o/p (6 Replies)
Hi Guys,
I have data in a file as follows:
a 1 2 3
b 4 5 6
a 6 7 8
a 4 7 9
b 6 8 5
c 0 8 7
So the number of rows which have data is variable (2 for the first group, one for the second group and three for the third group), but the delimiters between the... (10 Replies)
Context:
I need to remove unwanted newlines from a data file listing books and associated data. Here is a sample listing ( line numbers included ):
1 360762| Skip-beat! 14 /| 9781421517544| nb | 2008.| Nakamura, Yoshiki.| NAKAMUR | Kyoko Mogami followed
2 her true love Sho to Tokyo to... (6 Replies)
Hello,
I'm trying to create a shell variable with newlines inside it, so that when I echo the variable and pipe it to, say, awk, it output with the newlines. Why is this so problematic? I frankly don't know, but BASH seems to be stripping my variable of newlines. Here's an example
$ cat... (5 Replies)
I have been trying to remove some improperly formatted lines of output from fortran code I have been using. The problem is that I have some singularities in the math for some points that causes an incorrectly large value to be reported that exceeds the normal formating set in the code resulting in... (2 Replies)
Hi,
I wish to install solaris 10 on a target machine (t1000) by using Jumpstart. I have configured by jumpstart environment for the same. When i boot the target with the option "boot net -v install" i get the following error...
{0} ok boot net -v install
Boot device: /pci@7c0/pci@0/network@4... (3 Replies)