simple simple newbie quesition

simple simple newbie quesition

Post by otak » Thu, 01 Nov 2001 12:18:45



Okay, I want to write out the result of "date" command to a file, followed
by some information like this:

Tue 10/30/2001 - interview at IBM

How do I do this? On the prompt I tried "date >> output.txt" followed by
"echo ' - interview at IBM' >> output.txt" but the result was

Tue 10/30/2001
- interview at IBM

I also tried "date | sed '/\n/d' >> output.txt" followed by "echo
' -interview at IBM' >> output.txt". Still no dice.

How do I get rid of that newline?

 
 
 

simple simple newbie quesition

Post by Warren Da » Thu, 01 Nov 2001 12:44:30



>Okay, I want to write out the result of "date" command to a file, followed
>by some information like this:

>Tue 10/30/2001 - interview at IBM

>How do I do this? On the prompt I tried "date >> output.txt" followed by
>"echo ' - interview at IBM' >> output.txt" but the result was

>Tue 10/30/2001
>- interview at IBM

>I also tried "date | sed '/\n/d' >> output.txt" followed by "echo
>' -interview at IBM' >> output.txt". Still no dice.

>How do I get rid of that newline?

echo "`date` - interview at IBM" >> output.txt

 
 
 

simple simple newbie quesition

Post by Rudol » Fri, 02 Nov 2001 14:32:23




> Okay, I want to write out the result of "date" command to a file, followed
> by some information like this:

> Tue 10/30/2001 - interview at IBM

> How do I do this? On the prompt I tried "date >> output.txt" followed by
> "echo ' - interview at IBM' >> output.txt" but the result was

> Tue 10/30/2001
> - interview at IBM

> I also tried "date | sed '/\n/d' >> output.txt" followed by "echo
> ' -interview at IBM' >> output.txt". Still no dice.

> How do I get rid of that newline?

See the man page for echo.  I believe that using \c will supress the
newline that echo normally outputs.
 
 
 

simple simple newbie quesition

Post by Denis Zaitse » Mon, 05 Nov 2001 18:42:46



> Okay, I want to write out the result of "date" command to a file, followed
> by some information like this:

> Tue 10/30/2001 - interview at IBM

> How do I do this? On the prompt I tried "date >> output.txt" followed by
> "echo ' - interview at IBM' >> output.txt" but the result was

> Tue 10/30/2001
> - interview at IBM

> I also tried "date | sed '/\n/d' >> output.txt" followed by "echo
> ' -interview at IBM' >> output.txt". Still no dice.

> How do I get rid of that newline?

For example, echo -n `date`
 
 
 

simple simple newbie quesition

Post by Heiner Steve » Mon, 05 Nov 2001 21:19:51


 > Okay, I want to write out the result of "date" command to a file, followed
 > by some information like this:
 >
 > Tue 10/30/2001 - interview at IBM

The "date" command can be used like the "echo" command to
print arbitrary strings. Some special format specification characters
(%d, %m, ...) can be used to print parts of the date in the desired
format.

Example:

        date "+%a %m/%d/%Y - interview at IBM"

prints

        Sun 11/04/2001 - interview at IBM

A list of all format specifiers is documented in the strftime(3)
manual page.

Heiner
--
 ___ _

\__ \  _/ -_) V / -_) ' \    Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_|   http://www.shelldorado.com/

 
 
 

1. A simple question deserving a simple answer

: What does Unix (Specifically Linux) look like?  

A bunch of ones and zeros ;-)

: Is it like Dos? Windows?

No, thank God.

: Something else?

Yes.

There's a simple answer...

--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming

2. Athlon Motherboard!!??

3. simple date problem, simple solution?

4. Can't start lynx from inside an apache instance (error msg?)

5. a simple sed question ( there all simple :> )

6. A problem with my soundcard.

7. Simple question from simple user

8. FS: Completer UP1000 system with RedHat Linux 6.2 installed

9. Simple FTP question (very simple)

10. Simple sh script, simple error?

11. SUMMARY: simple shell for a simple man

12. simple banner printing not so simple

13. Can't create simple vdisk--no "simple" type