FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 08-11-2011, 05:18 AM
nathan nolast
 
Default Command help

can someone please inform me how this works

> filename.txt

this emptys the file but i cant find what > is doing, what is >*
--
Thank you for your time
~Nathan
nathan1465@gmail.com


Please consider the environment before printing this email.

This message contains confidential information and
is intended only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 05:32 AM
Goh Lip
 
Default Command help

On 08/11/2011 01:18 PM, nathan nolast wrote:

can someone please inform me how this works

> filename.txt

this emptys the file but i cant find what > is doing, what is >


http://www.simplehelp.net/2009/04/08/how-to-save-the-output-of-a-linux-command-to-a-file/


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 05:43 AM
Patton Echols
 
Default Command help

On 08/10/2011 10:18 PM, nathan nolast wrote:

can someone please inform me how this works

> filename.txt

this emptys the file but i cant find what > is doing, what is >


the > symbol puts the output of the command into the file. So try this

$echo "here is some text to try out"

Then try this:

$echo "here is some text to try out" > testfile.txt

Examine the file. Now try two more things:

$echo "this text should replace what was in the file" > testfile.txt

$echo "this text should NOT replace what was in the file before" >>
testfile.txt


Enjoy

--PE



--
Thank you for your time
~Nathan
nathan1465@gmail.com <mailto:nathan1465@gmail.com>

*Please consider the environment before printing this email. *

This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by
mistake and delete this e-mail from your system.





--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 06:18 AM
"Jordon Bedwell"
 
Default Command help

On Wed, August 10, 2011 10:18 pm, nathan nolast wrote:
> can someone please inform me how this works
>> filename.txt
> this emptys the file but i cant find what > is doing, what is >

It's called stdio redirection or some (well actually a lot of) people just
call it I/O redirection. You can redirect stdin and you can redirect. <<
< stdin stdout > >>, the proper way to truncate a file is actually ">
file.txt" or ":> file.txt" and nothing more, no echo, with an echo of any
kind you always end up with at least 1 byte written to the file which
defeats the purpose of what you are trying to do if you want to down and
dirty about it.

http://tldp.org/LDP/abs/html/io-redirection.html


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 02:53 PM
nathan nolast
 
Default Command help

nice, all great answers
i appreciate it.


On Thu, Aug 11, 2011 at 2:18 AM, Jordon Bedwell <jordon@envygeeks.com> wrote:


On Wed, August 10, 2011 10:18 pm, nathan nolast wrote:

> can someone please inform me how this works

>> filename.txt

> this emptys the file but i cant find what > is doing, what is >



It's called stdio redirection or some (well actually a lot of) people just

call it I/O redirection. *You can redirect stdin and you can redirect. *<<

< stdin stdout > >>, the proper way to truncate a file is actually ">

file.txt" or ":> file.txt" and nothing more, no echo, with an echo of any

kind you always end up with at least 1 byte written to the file which

defeats the purpose of what you are trying to do if you want to down and

dirty about it.



http://tldp.org/LDP/abs/html/io-redirection.html





--

ubuntu-users mailing list

ubuntu-users@lists.ubuntu.com

Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



--
Thank you for your time
~Nathan
nathan1465@gmail.com

Please consider the environment before printing this email.



This message contains confidential information and
is intended only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 03:03 PM
nathan nolast
 
Default Command help

so, is it possible to redirect the output of a file?

touch ioredirect.txt
echo "this is a test" > ioredirect.txt
vim.tiny ioredirect.txt** -- looks good
echo < ioredirect.txt

?


On Thu, Aug 11, 2011 at 10:53 AM, nathan nolast <nathan1465@gmail.com> wrote:

nice, all great answers
i appreciate it.


On Thu, Aug 11, 2011 at 2:18 AM, Jordon Bedwell <jordon@envygeeks.com> wrote:



On Wed, August 10, 2011 10:18 pm, nathan nolast wrote:

> can someone please inform me how this works

>> filename.txt

> this emptys the file but i cant find what > is doing, what is >



It's called stdio redirection or some (well actually a lot of) people just

call it I/O redirection. *You can redirect stdin and you can redirect. *<<

< stdin stdout > >>, the proper way to truncate a file is actually ">

file.txt" or ":> file.txt" and nothing more, no echo, with an echo of any

kind you always end up with at least 1 byte written to the file which

defeats the purpose of what you are trying to do if you want to down and

dirty about it.



http://tldp.org/LDP/abs/html/io-redirection.html





--

ubuntu-users mailing list

ubuntu-users@lists.ubuntu.com

Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



--
Thank you for your time
~Nathan
nathan1465@gmail.com


Please consider the environment before printing this email.



This message contains confidential information and
is intended only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system.




--
Thank you for your time
~Nathan
nathan1465@gmail.com

Please consider the environment before printing this email.


This message contains confidential information and
is intended only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 04:39 PM
Tero Pesonen
 
Default Command help

On Thu, 2011-08-11 at 11:03 -0400, nathan nolast wrote:
> so, is it possible to redirect the output of a file?
>
> touch ioredirect.txt
> echo "this is a test" > ioredirect.txt
> vim.tiny ioredirect.txt -- looks good
> echo < ioredirect.txt
>
> ?

cat < ioderict.txt

Note also the use of a pipe '|' for "piping" the standard output of one
command into another command's standard input.

e.g. something I do regularly, encrypt and decrypt a collection of
files:
tar cf - directory | gpg -c > directory.tar.gpg
gpg -d directory.tar.gpg | tar xf -

Or e.g. split the tar archive into 100MB chunks.
- tells tar to write to stdout, and split to read from stdin.
gpg reads and writes to stdout here by default.
tar cf - dir | gpg -c | split -b100m -d - dir.tar.gpg.

And decrypt:
cat dir.* | gpg -d | tar xf -

And so forth.

Tero



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 05:11 PM
Rajeev Prasad
 
Default Command help

it would redirect the null input into the file.


From: nathan nolast <nathan1465@gmail.com>
To: ubuntu-users@lists.ubuntu.com
Sent: Thursday, August 11, 2011 12:18 AM
Subject: Command help

can someone please inform me how this works

>
filename.txt

this emptys the file but i cant find what > is doing, what is >*
--
Thank you for your time
~Nathan
nathan1465@gmail.com


Please consider the environment before printing this email.

This message contains confidential information and
is intended only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system.



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 09:01 PM
Ric Moore
 
Default Command help

On Thu, 2011-08-11 at 11:03 -0400, nathan nolast wrote:
> so, is it possible to redirect the output of a file?
>

Please don't top post

> This message contains confidential information and is intended only
> for the individual named. If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail. Please notify
> the sender immediately by e-mail if you have received this e-mail by
> mistake and delete this e-mail from your system.

That is just annoying and doesn't mean squat legally. Ric


--
My father, Victor Moore (Vic) used to say:
"There are two Great Sins in the world...
..the Sin of Ignorance, and the Sin of Stupidity.
Only the former may be overcome." R.I.P. Dad.
Linux user# 44256


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-11-2011, 09:27 PM
chris
 
Default Command help

On Thu, 2011-08-11 at 17:01 -0400, Ric Moore wrote:
> On Thu, 2011-08-11 at 11:03 -0400, nathan nolast wrote:
> > so, is it possible to redirect the output of a file?
> >
>
> Please don't top post
>
> > This message contains confidential information and is intended only
> > for the individual named. If you are not the named addressee you
> > should not disseminate, distribute or copy this e-mail. Please notify
> > the sender immediately by e-mail if you have received this e-mail by
> > mistake and delete this e-mail from your system.
>
> That is just annoying and doesn't mean squat legally. Ric
>
>
> --
> My father, Victor Moore (Vic) used to say:
> "There are two Great Sins in the world...
> ..the Sin of Ignorance, and the Sin of Stupidity.
> Only the former may be overcome." R.I.P. Dad.
> Linux user# 44256
>
>

+1


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 07:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org