File size

File size

am 08.08.2004 11:00:45 von Anindya Mozumdar

Hi,
How can I make a file zero length without deleting the contents of
the file manually through an editor ?
Anindya.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 11:16:20 von Sascha Retzki

Am So, 2004-08-08 um 11.00 schrieb Anindya Mozumdar:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?

echo -n "">foo

> Anindya.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 13:44:44 von Roberto Vanto

Anindya Mozumdar ha scritto:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?
> Anindya.
> -

man touch

touch foo

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 13:55:13 von Aroop MP

You can make a file zero length by cat > foo and by typing CTRL-D
On Sunday 08 Aug 2004 5:14 pm, Roberto Vanto wrote:
> Anindya Mozumdar ha scritto:
> > Hi,
> > How can I make a file zero length without deleting the contents of
> > the file manually through an editor ?
> > Anindya.
> > -
>
> man touch
>
> touch foo
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Regards,
Aroop M.P
Bobcares Support Team
---------------------------------------------------
"NO MATTER WHERE YOU ARE IN THE WORLD,IF YOU HAVE DECIDED TO DO SOMETHING
DEEP FROM YOUR HEART YOU CAN DO IT. IT HAS ALWAYS BEEN THE THOUGHT THAT
MATTERS... "
---------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 14:01:41 von Sascha Retzki

Am So, 2004-08-08 um 13.44 schrieb Roberto Vanto:
> Anindya Mozumdar ha scritto:
> > Hi,
> > How can I make a file zero length without deleting the contents of
> > the file manually through an editor ?
> > Anindya.
> > -
>
> man touch
>
> touch foo

touch changes the timestamp if the file exists. It sounds like the file
already exists. btw, You don't need to delete it through an editor, "rm
foo ; touch foo" would do it, too. ;-)

>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 14:44:20 von Tim Walberg

cp /dev/null somefile



On 08/08/2004 14:30 +0530, Anindya Mozumdar wrote:
>> Hi,
>> How can I make a file zero length without deleting the contents of
>> the file manually through an editor ?
>> Anindya.
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
End of included message



--
+--------------------------+------------------------------+
| Tim Walberg | twalberg@mindspring.com |
| 830 Carriage Dr. | www.mindspring.com/~twalberg |
| Algonquin, IL 60102 | |
+--------------------------+------------------------------+
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 15:10:08 von Aroop MP

How can i attach one file on the top of another file.

Suppose file1 has 10 lines and file2 has 20 lines. I want to attach the 10
lines of file1 to file2 so that the file2 will have 30 lines in total.

On Sunday 08 Aug 2004 5:31 pm, Sascha Retzki wrote:
> Am So, 2004-08-08 um 13.44 schrieb Roberto Vanto:
> > Anindya Mozumdar ha scritto:
> > > Hi,
> > > How can I make a file zero length without deleting the contents of
> > > the file manually through an editor ?
> > > Anindya.
> > > -
> >
> > man touch
> >
> > touch foo
>
> touch changes the timestamp if the file exists. It sounds like the file
> already exists. btw, You don't need to delete it through an editor, "rm
> foo ; touch foo" would do it, too. ;-)
>
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Regards,
Aroop M.P
Bobcares Support Team
---------------------------------------------------
"NO MATTER WHERE YOU ARE IN THE WORLD,IF YOU HAVE DECIDED TO DO SOMETHING
DEEP FROM YOUR HEART YOU CAN DO IT. IT HAS ALWAYS BEEN THE THOUGHT THAT
MATTERS... "
---------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 15:20:03 von Sascha Retzki

Am So, 2004-08-08 um 15.10 schrieb Aroop MP:
> How can i attach one file on the top of another file.
>
> Suppose file1 has 10 lines and file2 has 20 lines. I want to attach the 10
> lines of file1 to file2 so that the file2 will have 30 lines in total.
>

cat file1 file2 >file3

> On Sunday 08 Aug 2004 5:31 pm, Sascha Retzki wrote:
> > Am So, 2004-08-08 um 13.44 schrieb Roberto Vanto:
> > > Anindya Mozumdar ha scritto:
> > > > Hi,
> > > > How can I make a file zero length without deleting the contents of
> > > > the file manually through an editor ?
> > > > Anindya.
> > > > -
> > >
> > > man touch
> > >
> > > touch foo
> >
> > touch changes the timestamp if the file exists. It sounds like the file
> > already exists. btw, You don't need to delete it through an editor, "rm
> > foo ; touch foo" would do it, too. ;-)
> >
> > > -
> > > To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 08.08.2004 15:57:01 von John Julian

To append file1 to file2 do:
cat file1 >> file2

Simple way to empty a file or make an empty file (bash or
ksh) do:
> file

On Sun, 8 Aug 2004, Aroop MP wrote:

> How can i attach one file on the top of another file.
>
> Suppose file1 has 10 lines and file2 has 20 lines. I want to attach the 10
> lines of file1 to file2 so that the file2 will have 30 lines in total.
>
> On Sunday 08 Aug 2004 5:31 pm, Sascha Retzki wrote:
> > Am So, 2004-08-08 um 13.44 schrieb Roberto Vanto:
> > > Anindya Mozumdar ha scritto:
> > > > Hi,
> > > > How can I make a file zero length without deleting the contents of
> > > > the file manually through an editor ?
> > > > Anindya.
> > > > -
> > >
> > > man touch
> > >
> > > touch foo
> >
> > touch changes the timestamp if the file exists. It sounds like the file
> > already exists. btw, You don't need to delete it through an editor, "rm
> > foo ; touch foo" would do it, too. ;-)
> >

--
John Julian
Computer Geek
cell: 248-787-2221
pager: 800-621-4951

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 09.08.2004 10:41:12 von mag

Anindya Mozumdar wrote:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?
> Anindya.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

do that from cmd line:

> /file


Adios,
D

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re:

am 09.08.2004 15:21:18 von Adam Lang

no
----- Original Message -----
From: "Debian UserJens Suelwald"
To: ;
Cc:
Sent: Sunday, August 08, 2004 11:45 AM


> unsubscribe linux-admin
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 09.08.2004 16:39:32 von Scott Taylor

Anindya Mozumdar said:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?

LMAO

If you are trying to get answers to a test or have us do your home work
for you, this is probably not the best place to do it. Here you will find
SysAdmins, not all are schooled and many times you will find answers here
that do not agree with your school book.

For stuff like this you should try linux-newbie@vger.kernel.org

Although, you may find a lot of bored SysAdmins here, giving you all kinds
of strange answers (some that are even wrong), this is not the appropriate
place. As funny as it is, people should not give wrong answers, and less
then knowlegdeable SysAdmins should not either.

BTW, "cp /dev/null > myFile" works, but may need to be contested to give
you accurate points on a test. Depending on your shell, probably, a
simple ">myFile" will be the proper response.



-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size (shortest possible solution) + don"t touch

am 09.08.2004 23:14:40 von Stephen Samuel

the shortest possible:
` > somefile `
(( redirect the output of no command at all to somefile ))

Although not necessary, I'll often go
` true > somefile `
True does nothing other than return success. The reason why
I like using it is that it makes a placeholder so that a reader
knows that something (or rather explicitly nothing) is happening.


`Touch` doesn't work.. If the file already exists, it will simply
change the last mod-time. without altering the contents

The original purpose of touch (I think) was to convince make(1) that
something needed to be done.

Anindya Mozumdar wrote:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?
> Anindya.


--
Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
http://www.bcgreen.com/~samuel/
Powerful committed communication. Transformation touching
the jewel within each person and bringing it to light.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size (shortest possible solution) + don"t touch

am 10.08.2004 00:47:17 von Daniel Berlin

How about
: > file
'' : '' does really absolutely nothing

daniel

Am Mo 09.08.2004 23:14 schrieb Stephen Samuel :

> the shortest possible:
> ` > somefile `
> (( redirect the output of no command at all to somefile ))
>
> Although not necessary, I'll often go
> ` true > somefile `
> True does nothing other than return success. The reason why
> I like using it is that it makes a placeholder so that a reader
> knows that something (or rather explicitly nothing) is happening.
>
>
> `Touch` doesn't work.. If the file already exists, it will simply
> change the last mod-time. without altering the contents
>
> The original purpose of touch (I think) was to convince make(1) that
> something needed to be done.
>
> Anindya Mozumdar wrote:
> > Hi,
> > How can I make a file zero length without deleting the contents of
> > the file manually through an editor ?
> > Anindya.
>
>
> --
> Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
> http://www.bcgreen.com/~samuel/
> Powerful committed communication. Transformation touching
> the jewel within each person and bringing it to light.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 10.08.2004 08:27:07 von Andrew Kelly

On Sun, 2004-08-08 at 11:00, Anindya Mozumdar wrote:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?


One more voice in the crowd...

:>foo

After we've helped you with your homework, do we get to put our hand up
your sweater?

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: File size

am 10.08.2004 15:47:29 von Anindya Mozumdar

Hi,
Thanks very much for your replies. However, this was not any homework
or assignment. This arose mainly from an argument regarding touch with
a fellow linux user, and since we did not have access to any machine
running linux, the best solution was this mail.

In fact, someone did give a wrong solution with touch, which was
precisely the point of argument. The mail was sent in the form below
so that we can get to know the other unnoticed ways, hoping that someone
mentions touch as a solution.
Anindya.

On Sun, Aug 08, 2004 at 02:30:45PM +0530, Anindya Mozumdar wrote:
> Hi,
> How can I make a file zero length without deleting the contents of
> the file manually through an editor ?
> Anindya.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html