public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Stone <xstonedogx@gmail.com>
To: linux-newbie@vger.kernel.org
Subject: Re: unusual uniq results
Date: Tue, 28 Sep 2004 09:11:30 -0700	[thread overview]
Message-ID: <a5bcf5da04092809114ecbb13d@mail.gmail.com> (raw)
In-Reply-To: <fc.004c4e0000647133004c4e0000647133.647263@palmertrinity.org>

The redirection takes place before your command.  So basically what
you told the system to do was:

1.  Create the file dup_num.  If the file exists overwrite it.
2.  Redirect stdout of "uniq dup_num" into dup_num.

Since you'd already overwritten the data in dup_num, there was nothing
for uniq to process.

On Tue, 28 Sep 2004 11:09:12 -0400, William Stanard
<wstanard@palmertrinity.org> wrote:
> In doing a demo before a class (Linux Red-hat 2.4.18-14), I used the uniq
> command on a file (dup_nums) that consisted of twelve lines, each line
> containing a number, from one to 9. I repeated the numbers, 6, 8, and 9.
> The std output showed the expected list of numbers, all duplicates
> removed. At a student's suggestion, I ran uniq again, but this time
> directed the output to the file itself....
> 
> uniq dup_num > dup_num
> 
> ...and, lo and behold, the file dup_num was empty. I checked uniq --help,
> info uniq, and man uniq, all to no avail. Shouldn't uniq have removed the
> duplicate numbers and written one through 9 to the file?
> 
> Bill stanard
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
> 



-- 
http://xstonedogx.heroesmarket.net
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2004-09-28 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-28 15:09 unusual uniq results William Stanard
2004-09-28 16:11 ` Stone [this message]
2004-09-29 11:07   ` William Stanard
2004-09-29 12:44     ` Simon Valiquette
2004-09-29 14:53     ` Yapo Sebastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5bcf5da04092809114ecbb13d@mail.gmail.com \
    --to=xstonedogx@gmail.com \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox