Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:36 AM
02-08-2002 05:36 AM
02/06/02 19:00:09
02/07/02 02:29:22
However I want to change it before I read it.
I want it all on the top line with a space in between like:
02/06/02 19:00:09 02/07/02 02:29:22
I need to do this in a script, not on command line. Any ideas greatly appreciated.
Thanks,
Bob
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:40 AM
02-08-2002 05:40 AM
Re: HELP
Use $(cat $file)
Then you have 1 line
ex
echo $(cat $file)
steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:43 AM
02-08-2002 05:43 AM
Re: HELP
cat /tmp/filename |awk '{printf ("%s %s ", $1, $2)}'
will print each entry without putting a line feed in. Only will work for 2 lines total per file.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:44 AM
02-08-2002 05:44 AM
Re: HELP
{
if ( firsttime == 1 ) {
firstline = $0
firsttime = 0
} else
{
print firstline, $0
firstline = ""
firsttime = 1
}
}
END {
if ( firsttime == 0 ) { print firstline }
}'
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:49 AM
02-08-2002 05:49 AM
Re: HELP
cat file | awk 'BEGIN {ORS=" "} {print $0}' -
This will set the output record separator to a single space and then print each line in the file.
Regards,
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:56 AM
02-08-2002 05:56 AM
Re: HELP
After 6 years I sometimes still feel like a novice. Script is not my bag. Thanks Clay, I used yours, less typing. Thanks everyone, great ideas.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 05:56 AM
02-08-2002 05:56 AM
Re: HELP
if you have to do this with a script, you could use the awk to manage it:
BEGIN { line = "" }
{
for ( NR <= 2 ) {
line = line " " $0 }
{
print line
}
}
the script can be called as follows:
awk -f script_name file_name
(if the file has more lines than two you have to change the script.... )
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 06:01 AM
02-08-2002 06:01 AM
Re: HELP
If it were only the first two lines of the file that you wanted joined into one, then you could use this:
# awk '{if (NR<3) {X=$0;getline;X=X" "$0;print X} else {print $0}}' myfile
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 06:57 AM
02-08-2002 06:57 AM
Re: HELP
This will "join" pairs of lines no matter how many are in the file:
while read line1
do
read line2
echo $line1 $line2
done
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 01:10 PM
02-08-2002 01:10 PM
Re: HELP
cat $file |xargs echo
Greg