The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
String substitution on find results inside exec/xargs myndcraft Shell Programming and Scripting 2 05-17-2008 02:36 PM
complex command substitution spopuri Shell Programming and Scripting 5 05-24-2006 08:37 AM
command substitution problems with csh using grep voodoo31 Shell Programming and Scripting 2 01-14-2006 07:39 AM
Preserving space during command substitution Sabari Nath S UNIX for Dummies Questions & Answers 1 10-04-2005 09:16 AM
Substitution of last command ghazi Shell Programming and Scripting 6 01-16-2005 07:06 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-16-2008
ncatdesigner ncatdesigner is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 19
joining command results, and substitution

Hello community

I'd like to join to command results and put it to the same line in one file, how can I do that?

file: a.txt

so when I put Date '+%H:%M' and echo date '+%D' in the file appears 14:44 01/05/08 not
14:44
01/05/08

I like to know how can I make a substituion of a whole line in a file, to put an example I'd like to change the line where the first column it's like 14:44 for 14:44 02/05/08

Thanks
  #2 (permalink)  
Old 04-16-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
date '+%H:%M %D'
  #3 (permalink)  
Old 04-17-2008
ncatdesigner ncatdesigner is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 19
Ok XD

Let's suppose the commands are different, maybe one is a query to the system with the largest file on a folder and the other is the current date so the result should be:

ls | sort ... | cut .... (or tail) ...
date ...

the result could be "somefile.dat 19/01/12"

not

somefile.dat
19/01/12

Sorry for my bad explanation :_(
  #4 (permalink)  
Old 04-17-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
don't understand where the issue is......
  #5 (permalink)  
Old 04-17-2008
ncatdesigner ncatdesigner is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 19
when I execute a command and put it in a file this is insered as a whole line.

I want to insert the result of two commands in the same line of a file.

ls | sort ... | cut .... (or tail) ... + date ...
  #6 (permalink)  
Old 04-17-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
#!/bin/ksh

(ls ; echo -n " $(date '+%H:%M %D') ) | sort ... | cut .... (or tail)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0