Sponsored Content
Full Discussion: Remove newlines
Top Forums UNIX for Dummies Questions & Answers Remove newlines Post 302890784 by wisecracker on Friday 28th of February 2014 01:52:24 PM
Old 02-28-2014
Your sample file looks as though it contains 0 0 after every required line.

How about trying this, pseudo-code, longhand:-
Code:
Step 1) Remove ALL newlines, using say the "tr" command and save as a different FileName.
Step 2) Now read in the new flat file called FileName into a variable.
Step 3) As the sample looks as though every line ends in the three characters above do
a loop and comparison of those 3 characters and ADD a newline to the end of each set.
Step 4) Save the file as NewFileName and finally do a check using say......
Step 5) cat < /full/path/to/NewFileName.

There are better ways but at least it gives you some logic to work on...

EDIT:
We are assuming at this point that there are no carriage returns, "\r", inside your sample.

Last edited by wisecracker; 02-28-2014 at 02:58 PM.. Reason: See above.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - need to remove unwanted newlines on match

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)
Discussion started by: Bubnoff
6 Replies

2. Shell Programming and Scripting

Transpose with two newlines as delimiter

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)
Discussion started by: npatwardhan
10 Replies

3. Shell Programming and Scripting

Remove improperly placed newlines

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: ... (2 Replies)
Discussion started by: mikesimone
2 Replies

4. Shell Programming and Scripting

sed remove newlines and spaces

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)
Discussion started by: rishav
6 Replies

5. Shell Programming and Scripting

Delete newlines after every one space

Hi All, I have a file which looks like this: abc 3456 computer 3214 printer 0.9823 computer 3214 Can anyone please let me know how I can format my text like this? abc 3456 computer 3214 printer 0.9823 computer 3214 I know how to space to newlines using tr but don't know how to do... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

6. Shell Programming and Scripting

removing newlines after a certain word.

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)
Discussion started by: DaytonCPS
3 Replies

7. Shell Programming and Scripting

Need help with eliminating newlines with Perl

Good morning, I need some help with getting rid of newlines with the output from a MYSQL query and putting the information into the right format that I need. Here is the script as it is today: #!/usr/bin/perl my $uda = system("/opt/incontrol/mysql/bin/mysql -u root -ppassword... (2 Replies)
Discussion started by: brianjb
2 Replies

8. UNIX for Dummies Questions & Answers

Using find with awk to remove newlines

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)
Discussion started by: kristinu
5 Replies

9. UNIX for Beginners Questions & Answers

Remove newlines and carriage return from a csv file using UNIX

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)
Discussion started by: A_Gaddale
3 Replies

10. Shell Programming and Scripting

UNIX file with Newlines

Hi Friends, I have a data file with new lines. How to remove the newlines and should be showed in one line. I tried using the command tr -d '\n' filename sed 's/\n//g' file name Ex: 1 abc hyd is actual record but in our scenario showing it as 1 abc hydthis record should be like... (5 Replies)
Discussion started by: victory
5 Replies
PCIC(4) 						   BSD Kernel Interfaces Manual 						   PCIC(4)

NAME
pcic -- PC Card bridge driver SYNOPSIS
device pcic device pccard DESCRIPTION
The pcic driver provides support for older ISA and non-Yenta PCI PC Card bridges. The pcic driver supports most ExCA devices attached to the ISA bus or PCI devices that do not conform to the Yenta specification. The following ISA devices, or true clones, are supported in the current code. Intel i82365SL Step A Intel i82365SL Step B Intel i82365SL Step C Intel's original 16-bit PC Card controller. Intel i82365SL-DF Intel's last version of this device. 3.3V support was added. VLSI 82C146 An older VLSI part with some issues on some machines. Cirrus Logic PD-6710 Cirrus Logic PD-6720 Cirrus Logic PD-6722 Cirrus Logic's pcic controller. Compatible with the i82365SL Step C with the addition of a different 3.3V control. Ricoh RF5C296 Ricoh RF5C396 Ricoh's PC Card bridge chips. These are compatible with the i82365SL Step C, but with yet another different 3.3V con- trol. Vadem 365 Vadem 465 Compatible with i82365SL Step C. Vadem 468 Vadem 469 Like the earlier Vadem models, but with Vadem's own, incompatible, 3.3V control system. IBM PCIC IBM clone of the original i82365SL part, with its own ID register value. Has no 3.3V ability. Many other vendors made parts in this arena, but most of them were compatible with one of the above chipsets. The following PCI pcmcia bridges are supported: Cirrus Logic PD6729 Cirrus Logic PD6730 O2micro OZ6729 O2micro OZ6730 BUGS
This does not work at all at the moment. BSD
July 9, 2002 BSD
All times are GMT -4. The time now is 09:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy