|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|||
Putting Lines to Together.
Hi Guys,
Sorry if this may seem like a stupid question. I can probably find my answer on google, but I don't know exactly what I should search for. So here's what I would like to do: Let's say I have a text file containing the following: Hi, my name is bigb89. What could I do to make that same file like this?: Hi, my name is bigb89. It doesn't matter the language I use (shell, perl, awk, sed, etc). I just would like know of a way that I can achieve that. Regards. |
|
||||
One easy way is with tr(1):
% cat text_file | tr '\n' ' ' But watch out -- that will strip off the very last newline as well (which you probably don't want).
__________________
Kill your t.v. |
|
||||
How I would do it:
$ ex - -c '%j|wq' file' If you want to join a specific range of lines, replace the '%' with 'startline-number,endline-number'
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
%xargs echo < your_file
Have a look at this webpage for more alternative solutions: http://linux.dsplabs.com.au/rmnl-rem...-sam-ssam-p65/
__________________
The power of plain text? It can control an entire OS |
|
|||
Hi Guys,
Thank you all for all the replies! I'll try out those commands to see how it works out! |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Putting Free/Net/Open - BSDs on one HDD | alpopa | NetBSD Installation and Upgrading | 6 | 23rd December 2008 08:16 PM |
Deleting lines with certain letters/keywords. | bigb89 | Programming | 4 | 12th November 2008 11:59 PM |
Spare PC, need ideas for putting it to use | TerryP | Off-Topic | 9 | 21st July 2008 02:10 PM |
Adding multiple lines into file | c0mrade | Programming | 4 | 7th June 2008 11:03 PM |