Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Install seq, a sequence generator UNIX

Today I missed having seq (from the GNU coreutils package), which prints a sequence of numbers. I downloaded the source and compiled it without any problems. The following steps assume that you already have a ~/bin directory.

  • Download the coreutils package [3.8mb download].
  • If the package didn't expand autoatmically, open a Terminal in your downloads folder, and type tar -xjf coreutils-5.0.tar.bz2.
  • Now it's time to compile the package:
     % cd coreutils-5.0
     % ./configure
     % make
     % cp src/seq ~/bin
    
Now you have seq available when ~/bin is in your path. I executed the following steps to have the man page available as well:
 % mkdir ~/bin/man
 % mkdir ~/bin/man/man1
 % cp man/seq.1 ~/bin/man/man1
Add export MANPATH=~/bin/man:$MANPATH to your .bashrc. You have to do something equivalent if you are using tcsh. Now man seq should work as well.

[robg adds: The coreutils package contains a ton of useful utilities, many of which are versions existing commands (ls, echo, cp, etc.). The package compiled successfully for me on 10.3, but I'm not planning on installing the full set of files; seq works as expected, though.]
    •    
  • Currently 3.00 / 5
  You rated: 4 / 5 (4 votes cast)
 
[5,686 views]  

Install seq, a sequence generator | 5 comments | Create New Account
Click here to return to the 'Install seq, a sequence generator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Install seq, a sequence generator
Authored by: Ranger Rick on Dec 10, '03 11:54:22AM

Definitely, don't install the full set or you will have problems.

The default coreutils has a "uname" that will mess up pretty much anything that uses autoconf to build (part of the host identifier shows up as "unknown"). Also, 5.0 uses some APIs that are buggy on darwin, and a number of the included tools will have strange issues with large directories.

If you are going to install all of coreutils, don't install uname, and use the newer beta release of coreutils from alpha.gnu.org instead of the one linked from this tip.



[ Reply to This | # ]
Install seq, a sequence generator
Authored by: formido on Dec 10, '03 12:51:36PM

Don't know seq, but another way to write a sequence of numbers is the built-in jot command. 'jot 10', for example, plus other options, of course, as in the man.



[ Reply to This | # ]
Install seq, a sequence generator
Authored by: mstillwell on Dec 10, '03 08:09:02PM
It's actually pretty easy to get the "make install" option to install everything in your home directory. If you add a --prefix switch to the ./configure line:

$ ./configure --prefix=$HOME/local
then

$ make
$ make install
will install the binaries in ~/local/bin, the man pages in ~/local/man and so forth.

[ Reply to This | # ]
Install seq, a sequence generator
Authored by: patashnik on Dec 11, '03 03:46:37AM

MacOSX comes with /usr/bin/jot, which does pretty much the same as seq (AFAIK, but I'm not a Linux user :)



[ Reply to This | # ]
Install seq, a sequence generator
Authored by: patrickoehlinger on Dec 13, '03 07:33:23AM
If you just need seq, I found it more easy to place the following function in my .bashrc file.

function seq() {
    local I=$1;
    while [ $2 != $I ]; do
        {
            echo -n "$I ";
            I=$(( $I + 1 ))
        };
    done;
    echo $2
}
To do so, type pico ~/.bashrc in your Terminal and copy the above code.

[ Reply to This | # ]