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 > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 11-28-2007, 07:11 PM
"Jacques B."
 
Default insert file?

On Nov 28, 2007 2:56 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > head -n 3 file;who;tail -n $(echo "$(wc -l file | cut -d " " -f 1) -3" |bc) file
>
> ( head -n3 file; who; tail +3 file) > newfile 2> errors
>
> Much easier
>
>

Dang! Missed that at the end of man tail. Would have saved me from
remembering some of the syntax I suggested. But mine puts hair on
your chest! If there is an easy way and a hard way to do something,
real men take the hard way. That's why women don't need hair on their
chest, because they are smart enough to take the easy way.

It does show an interesting way to incorporate calculations in a
command so all is not lost.

Jacques B.

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 11-28-2007, 07:40 PM
"Mikkel L. Ellertson"
 
Default insert file?

Alan Cox wrote:
>> head -n 3 file;who;tail -n $(echo "$(wc -l file | cut -d " " -f 1) -3" |bc) file
>
> ( head -n3 file; who; tail +3 file) > newfile 2> errors
>
> Much easier
>
I think you need to change "tail +3" to "tail -n +3" or tail will
treat +3 as a file name.

Mikkel
--

Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 11-28-2007, 10:09 PM
"Jacques B."
 
Default insert file?

On Nov 28, 2007 3:40 PM, Mikkel L. Ellertson <mikkel@infinity-ltd.com> wrote:
>
> Alan Cox wrote:
> >> head -n 3 file;who;tail -n $(echo "$(wc -l file | cut -d " " -f 1) -3" |bc) file
> >
> > ( head -n3 file; who; tail +3 file) > newfile 2> errors
> >
> > Much easier
> >
> I think you need to change "tail +3" to "tail -n +3" or tail will
> treat +3 as a file name.
>
>
> Mikkel
> --

No, that is the correct syntax. No -n when telling tail to start at
the "N"th line.

tail -n 5
will give you the last five lines
tail +5
will start at the fifth line (according to man pages, so doesn't skip
5 lines - I tested it earlier but didn't pay close enough attention -
not in Linux now so can't test right now) and give you the rest of the
file

Jacques B.

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 11-28-2007, 10:23 PM
"Mikkel L. Ellertson"
 
Default insert file?

Jacques B. wrote:
>
> No, that is the correct syntax. No -n when telling tail to start at
> the "N"th line.
>
> tail -n 5
> will give you the last five lines
> tail +5
> will start at the fifth line (according to man pages, so doesn't skip
> 5 lines - I tested it earlier but didn't pay close enough attention -
> not in Linux now so can't test right now) and give you the rest of the
> file
>
> Jacques B.
>
Maybe it is just the version of tail in Fc6, but this is what I get:

$ tail +3 README
tail: cannot open `+3' for reading: No such file or directory
==> README <==
Revelation depends on the following software:
<--------[The rest of the file]--------->

$ tail -n +3 README
secure place, and gives access to them through a user-friendly graphical
interface.
<--------[The rest of the file]--------->

The file starts with:
Revelation is a password manager for the GNOME 2 desktop, released
under the GNU GPL license. It stores accounts and passwords in a single,
secure place, and gives access to them through a user-friendly graphical
interface.

and ends with:
Revelation depends on the following software:

- GNOME 2.10
- GTK+ 2.8
- Python 2.3
- pygtk 2.8
- gnome-python 2.10
- gnome-python-extras 2.10
- pycrypto 1.9
- cracklib

Mikkel
--

Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 11-28-2007, 10:47 PM
Les Mikesell
 
Default insert file?

Mikkel L. Ellertson wrote:

Jacques B. wrote:

No, that is the correct syntax. No -n when telling tail to start at
the "N"th line.

tail -n 5
will give you the last five lines
tail +5
will start at the fifth line (according to man pages, so doesn't skip
5 lines - I tested it earlier but didn't pay close enough attention -
not in Linux now so can't test right now) and give you the rest of the
file

Jacques B.


Maybe it is just the version of tail in Fc6, but this is what I get:

$ tail +3 README
tail: cannot open `+3' for reading: No such file or directory


Posix doesn't like +'s as option flags these days, and gnu utilities
don't like updating their man pages. Try

tail -n +3 README
(and info tail)

--
Les Mikesell
lesmikesell@gmail.com

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 11-28-2007, 11:14 PM
"Jacques B."
 
Default insert file?

On Nov 28, 2007 6:47 PM, Les Mikesell <lesmikesell@gmail.com> wrote:
> Mikkel L. Ellertson wrote:
> > Jacques B. wrote:
> >> No, that is the correct syntax. No -n when telling tail to start at
> >> the "N"th line.
> >>
> >> tail -n 5
> >> will give you the last five lines
> >> tail +5
> >> will start at the fifth line (according to man pages, so doesn't skip
> >> 5 lines - I tested it earlier but didn't pay close enough attention -
> >> not in Linux now so can't test right now) and give you the rest of the
> >> file
> >>
> >> Jacques B.
> >>
> > Maybe it is just the version of tail in Fc6, but this is what I get:
> >
> > $ tail +3 README
> > tail: cannot open `+3' for reading: No such file or directory
>
> Posix doesn't like +'s as option flags these days, and gnu utilities
> don't like updating their man pages. Try
> tail -n +3 README
> (and info tail)
>
> --
> Les Mikesell
> lesmikesell@gmail.com
>
>
> --
> fedora-list mailing list
> fedora-list@redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

I wasn't sitting at a Fedora box at work when I tested it. I was
sitting at a BackTrac 2 box (a Slackware based security distro). That
could explain the difference. Lesson for the future, wait until I'm
at my Fedora box so I can test it there before posting a reply.

Alex did you try it on a Fedora box? If so what version? Seeing you
posted with that syntax I'm guessing it worked for you as well.

Thanks,

Jacques

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 

Thread Tools




All times are GMT. The time now is 03:39 AM.

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