Hello guys,
i want to have those lines joined to one line with spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is limited to 2000 characters. There must be something better.
Thanks in advance!
David
--- On Wed, 10/1/08, David Hláčik david@hlacik.eu wrote:
From: David Hláčik david@hlacik.eu Subject: howto join lines To: "Fedora" fedora-list@redhat.com Date: Wednesday, October 1, 2008, 3:13 PM Hello guys,
i want to have those lines joined to one line with spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is limited to 2000 characters. There must be something better.
Thanks in advance!
David
use vi and "J"
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
Around 04:13pm on Wednesday, October 01, 2008 (UK time), David Hláčik scrawled:
Hello guys,
i want to have those lines joined to one line with spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is limited to 2000 characters. There must be something better.
Use vi - commands gqap
Steve
Around 04:40pm on Wednesday, October 01, 2008 (UK time), Fred Silsbee scrawled:
use vi and "J"
J will only join two lines, although you could use 20000J (although you need the number of linnes correct). gqap will be better I think.
Steve
On Wed, 2008-10-01 at 17:13 +0200, David Hláčik wrote:
Hello guys,
i want to have those lines joined to one line with spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is limited to 2000 characters. There must be something better.
Hi David,
It's unclear if you want to do this interactively or from the command line, and whether you want to affect all lines or just selected ones. If you want to put all of the lines in a file onto one, you could use:
tr "\012" " " # convert newlines to spaces
-Chris
echo 'textone texttwo something'|xargs textone texttwo something
On Wed, Oct 1, 2008 at 5:13 AM, David Hláčik david@hlacik.eu wrote:
Hello guys,
i want to have those lines joined to one line with spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is limited to 2000 characters. There must be something better.
Thanks in advance!
David
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
--- On Wed, 10/1/08, Dave Burns tburns@hawaii.edu wrote:
From: Dave Burns tburns@hawaii.edu Subject: Re: howto join lines To: "Community assistance, encouragement, and advice for using Fedora." fedora-list@redhat.com Date: Wednesday, October 1, 2008, 5:51 PM echo 'textone texttwo something'|xargs textone texttwo something
On Wed, Oct 1, 2008 at 5:13 AM, David Hláčik david@hlacik.eu wrote:
Hello guys,
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is
limited to 2000
characters. There must be something better.
Thanks in advance!
David
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe:
https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines:
http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
--
the good old command line "cat" was invented (I am told) to concatenate!
need to know the whole problem first! editing, scripting, programming
———————————————————————- Q: Why should this email be 5 sentences or less? A: http://five.sentenc.es
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
On Wed, 2008-10-01 at 10:58 -0700, Fred Silsbee wrote:
--- On Wed, 10/1/08, Dave Burns tburns@hawaii.edu wrote:
From: Dave Burns tburns@hawaii.edu Subject: Re: howto join lines To: "Community assistance, encouragement, and advice for using Fedora." fedora-list@redhat.com Date: Wednesday, October 1, 2008, 5:51 PM echo 'textone texttwo something'|xargs textone texttwo something
On Wed, Oct 1, 2008 at 5:13 AM, David Hláčik david@hlacik.eu wrote:
Hello guys,
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is
limited to 2000
characters. There must be something better.
Thanks in advance!
David
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe:
https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines:
http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
--
the good old command line "cat" was invented (I am told) to concatenate!
'cat' will not remove newlines.
need to know the whole problem first! editing, scripting, programming
Agreed.
poc
Patrick O'Callaghan wrote:
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
the good old command line "cat" was invented (I am told) to concatenate!
'cat' will not remove newlines.
Not by itself, but its a reasonable thing to run in backticks so the shell will do it for you:
echo `cat multi_line_file` or echo $(cat multi_line_file`) if you prefer that syntax.
Well i need it for script written in bash .
Thanks
On Wed, Oct 1, 2008 at 8:30 PM, Patrick O'Callaghan pocallaghan@gmail.com wrote:
On Wed, 2008-10-01 at 10:58 -0700, Fred Silsbee wrote:
--- On Wed, 10/1/08, Dave Burns tburns@hawaii.edu wrote:
From: Dave Burns tburns@hawaii.edu Subject: Re: howto join lines To: "Community assistance, encouragement, and advice for using Fedora." fedora-list@redhat.com Date: Wednesday, October 1, 2008, 5:51 PM echo 'textone texttwo something'|xargs textone texttwo something
On Wed, Oct 1, 2008 at 5:13 AM, David Hláčik david@hlacik.eu wrote:
Hello guys,
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
So far i have been using fmt -w 2000 , but this is
limited to 2000
characters. There must be something better.
Thanks in advance!
David
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe:
https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines:
http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
--
the good old command line "cat" was invented (I am told) to concatenate!
'cat' will not remove newlines.
need to know the whole problem first! editing, scripting, programming
Agreed.
poc
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
On Wed, 1 Oct 2008 21:43:33 +0200 "David Hláčik" david@hlacik.eu wrote:
Well i need it for script written in bash .
http://student.northpark.edu/pemente/sed/sed1line.txt
might be helpful
On Wed, 2008-10-01 at 14:40 -0500, Les Mikesell wrote:
Patrick O'Callaghan wrote:
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
the good old command line "cat" was invented (I am told) to concatenate!
'cat' will not remove newlines.
Not by itself, but its a reasonable thing to run in backticks so the shell will do it for you:
echo `cat multi_line_file` or echo $(cat multi_line_file`)
Or to avoid the fork & exec:
echo $(<multi_line_file)
-Chris
On Wed, Oct 01, 2008 at 03:55:08PM -0400, Chris Tyler wrote:
On Wed, 2008-10-01 at 14:40 -0500, Les Mikesell wrote:
Patrick O'Callaghan wrote:
i want to have those lines joined to one line with
spaces
Before :
textone texttwo something
After :
textone texttwo something
echo `cat multi_line_file` or echo $(cat multi_line_file`)
Or to avoid the fork & exec:
echo $(<multi_line_file)
But you will end up with problems with the number of arguments on a command line if multi_line_file is too large.
How about:
cat multi_line_file | xargs
Note that the default command for xargs is echo
Or, to avoid a "useless use of cat" award (see http://partmaps.org/era/unix/award.html):
xargs < multi_line_file
On Thu, 2008-10-02 at 09:37 +1000, Norman Gaywood wrote:
On Wed, Oct 01, 2008 at 03:55:08PM -0400, Chris Tyler wrote:
On Wed, 2008-10-01 at 14:40 -0500, Les Mikesell wrote:
Patrick O'Callaghan wrote:
> i want to have those lines joined to one line with spaces > Before : > > textone > texttwo > something > > After : > > textone texttwo something >
echo `cat multi_line_file` or echo $(cat multi_line_file`)
Or to avoid the fork & exec:
echo $(<multi_line_file)But you will end up with problems with the number of arguments on a command line if multi_line_file is too large.
How about:
cat multi_line_file | xargs
Note that the default command for xargs is echo
Or, to avoid a "useless use of cat" award (see http://partmaps.org/era/unix/award.html):
xargs < multi_line_file
Alas, that doesn't solve the problem with the excessive number/length of arguments either, because xargs will execute the echo multiple times if necessary to keep within the arg limits, potentially generating newlines in the output.
...Which is why I like the translate I proposed earlier:
tr "\012" " " <multi_line_file
-- Chris
On Wed, 2008-10-01 at 20:04 -0400, Chris Tyler wrote:
On Thu, 2008-10-02 at 09:37 +1000, Norman Gaywood wrote:
On Wed, Oct 01, 2008 at 03:55:08PM -0400, Chris Tyler wrote:
On Wed, 2008-10-01 at 14:40 -0500, Les Mikesell wrote:
Patrick O'Callaghan wrote:
>> i want to have those lines joined to one line with > spaces >> Before : >> >> textone >> texttwo >> something >> >> After : >> >> textone texttwo something >>
echo `cat multi_line_file` or echo $(cat multi_line_file`)
Or to avoid the fork & exec:
echo $(<multi_line_file)But you will end up with problems with the number of arguments on a command line if multi_line_file is too large.
How about:
cat multi_line_file | xargs
Note that the default command for xargs is echo
Or, to avoid a "useless use of cat" award (see http://partmaps.org/era/unix/award.html):
xargs < multi_line_file
Alas, that doesn't solve the problem with the excessive number/length of arguments either, because xargs will execute the echo multiple times if necessary to keep within the arg limits, potentially generating newlines in the output.
...Which is why I like the translate I proposed earlier:
tr "\012" " " <multi_line_file
tr -d "\012" < multi_line_file
is slightly more elegant. Of course this assumes the file is ASCII or similar.
poc
On Wed, 2008-10-01 at 20:09 -0430, Patrick O'Callaghan wrote:
On Wed, 2008-10-01 at 20:04 -0400, Chris Tyler wrote:
On Thu, 2008-10-02 at 09:37 +1000, Norman Gaywood wrote:
On Wed, Oct 01, 2008 at 03:55:08PM -0400, Chris Tyler wrote:
On Wed, 2008-10-01 at 14:40 -0500, Les Mikesell wrote:
Patrick O'Callaghan wrote:
>>> i want to have those lines joined to one line with >> spaces >>> Before : >>> >>> textone >>> texttwo >>> something >>> >>> After : >>> >>> textone texttwo something >>>
echo `cat multi_line_file` or echo $(cat multi_line_file`)
Or to avoid the fork & exec:
echo $(<multi_line_file)But you will end up with problems with the number of arguments on a command line if multi_line_file is too large.
How about:
cat multi_line_file | xargs
Note that the default command for xargs is echo
Or, to avoid a "useless use of cat" award (see http://partmaps.org/era/unix/award.html):
xargs < multi_line_file
Alas, that doesn't solve the problem with the excessive number/length of arguments either, because xargs will execute the echo multiple times if necessary to keep within the arg limits, potentially generating newlines in the output.
...Which is why I like the translate I proposed earlier:
tr "\012" " " <multi_line_file
tr -d "\012" < multi_line_file
is slightly more elegant. Of course this assumes the file is ASCII or similar.
poc
But the OP said:
i want to have those lines joined to one line with spaces
-Chris
On Wed, 2008-10-01 at 21:04 -0400, Chris Tyler wrote:
...Which is why I like the translate I proposed earlier:
tr "\012" " " <multi_line_file
tr -d "\012" < multi_line_file
is slightly more elegant. Of course this assumes the file is ASCII
or
similar.
poc
But the OP said:
i want to have those lines joined to one line with spaces
True, I'd missed that.
poc