Sponsored Content
Top Forums Shell Programming and Scripting How to generate a series of numbers Post 302181748 by radoulov on Friday 4th of April 2008 02:21:27 AM
Old 04-04-2008
With zsh:

Code:
setopt braceccl
eval print -l $(printf "{%s}\n" $=input:gs/-/../:gs/,/\ )

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

generate level numbers

Hi... I have a sequence of jobs and its predecessors.. Input Job_Name Predecessor A NULL B1 A B2 A B3 B1 C B3 C B2 So based on these i have to generate the level Number What i mean is Let A be level 1 for B1 to happen it should have done A so B1 level is A+1 = 1+1 = 2 (12 Replies)
Discussion started by: pbsrinivas
12 Replies

2. Shell Programming and Scripting

How to sort out the latest one from a series of numbers?

Hi, I have a directory which contains a number of sub directories. They are named as 1.0.0, 1.0.1, 1.0.2...1.1.0..1.1.1...1.2.0..and so on.. Basically these are the tags created at the time of release. Tags are named as major.minor.buildnumber format for modules. Now I have to search the... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

3. Shell Programming and Scripting

Shell script to generate Fibonacci series using recursion

I am facing problem with Shell script to generate Fibonacci series using recursion i.e. recursive function. Here is my script: #!/bin/sh fibo() { no=$1 if ; then return 0 elif ; then return 1 else a1=`expr $no - 1` fibo $a1 ... (10 Replies)
Discussion started by: Tapas Bose
10 Replies

4. Shell Programming and Scripting

How to code a series of numbers in SH

Hi. How can I write this in a shorter way? for NUMs in 1 2 3 4 5 6 I looked at the"seq" command, but I do not think that is what I want. Can I code for NUMs (1..7) Hey!! Is that it? (8 Replies)
Discussion started by: Ccccc
8 Replies

5. Homework & Coursework Questions

Help with shell script to find sum of first n numbers of Fibonacci series

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Shell script to find sum of first n numbers of Fibonacci series 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: Kshitija
0 Replies

6. UNIX for Dummies Questions & Answers

To find missing numbers from a number series

Hi, My requirement is I have an input file with a continuous series from 10000 to 99999. I have some numbers missing from those series. I want a output file which produces those missing numbers. Eg: 10002, 99999 are missing from the series then the output file should contain those... (4 Replies)
Discussion started by: rakeshbharadwaj
4 Replies

7. Shell Programming and Scripting

How to generate 10.000 unique numbers?

hello, does anybody can give me a hint on how to generate a lot of numbers which are not identically via scripting etc? (7 Replies)
Discussion started by: xrays
7 Replies

8. Shell Programming and Scripting

AWK series of numbers

Hi, I have a dataset say 1 2 3 4 5 5 6 7 6 7 8 9 I was wondering if there is a way to add another column with the following style... 1 2 3 4 xyz_1 5 5 6 7 xyz_2 6 7 8 9 xyz_3 It would be greatly appreciated if I can have an option of specifying what to write instead of xyz,... (8 Replies)
Discussion started by: jacobs.smith
8 Replies

9. Shell Programming and Scripting

Auto generate Line Numbers

How do I generate line numbers in Vi? I have this: ,'04-90020-039N','61423','2GDV00039-0002', SYSDATE); ,'04-90020-040D','61423','2GDV00046-0001', SYSDATE); ,'04-90020-041N','61423','2GDV00038-0002', SYSDATE); ,'04-90020-043D','61423','2GDV00047-0001', SYSDATE);... (3 Replies)
Discussion started by: djehresmann
3 Replies

10. Shell Programming and Scripting

Moving decimal point in a series of numbers

Hi, i need to move the decimal point from a file listing some numbers like this : 49899.50 49914.55 49894.48 49939.65 49879.44 49919.57 49934.62 49944.67 49954.72 (1 Reply)
Discussion started by: Board27
1 Replies
ERR(3)							   BSD Library Functions Manual 						    ERR(3)

NAME
err, verr, errc, verrc, errx, verrx, warn, vwarn, warnc, vwarnc, warnx, vwarnx, err_set_exit, err_set_file -- formatted error messages LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <err.h> void err(int eval, const char *fmt, ...); void err_set_exit(void (*exitf)(int)); void err_set_file(void *vfp); void errc(int eval, int code, const char *fmt, ...); void errx(int eval, const char *fmt, ...); void warn(const char *fmt, ...); void warnc(int code, const char *fmt, ...); void warnx(const char *fmt, ...); #include <stdarg.h> void verr(int eval, const char *fmt, va_list args); void verrc(int eval, int code, const char *fmt, va_list args); void verrx(int eval, const char *fmt, va_list args); void vwarn(const char *fmt, va_list args); void vwarnc(int code, const char *fmt, va_list args); void vwarnx(const char *fmt, va_list args); DESCRIPTION
The err() and warn() family of functions display a formatted error message on the standard error output, or on another file specified using the err_set_file() function. In all cases, the last component of the program name, a colon character, and a space are output. If the fmt argument is not NULL, the printf(3)-like formatted error message is output. The output is terminated by a newline character. The err(), errc(), verr(), verrc(), warn(), warnc(), vwarn(), and vwarnc() functions append an error message obtained from strerror(3) based on a supplied error code value or the global variable errno, preceded by another colon and space unless the fmt argument is NULL. In the case of the errc(), verrc(), warnc(), and vwarnc() functions, the code argument is used to look up the error message. The err(), verr(), warn(), and vwarn() functions use the global variable errno to look up the error message. The errx() and warnx() functions do not append an error message. The err(), verr(), errc(), verrc(), errx(), and verrx() functions do not return, but exit with the value of the argument eval. It is recom- mended that the standard values defined in sysexits(3) be used for the value of eval. The err_set_exit() function can be used to specify a function which is called before exit(3) to perform any necessary cleanup; passing a null function pointer for exitf resets the hook to do nothing. The err_set_file() function sets the output stream used by the other functions. Its vfp argument must be either a pointer to an open stream (possibly already converted to void *) or a null pointer (in which case the output stream is set to standard error). EXAMPLES
Display the current errno information string and exit: if ((p = malloc(size)) == NULL) err(EX_OSERR, NULL); if ((fd = open(file_name, O_RDONLY, 0)) == -1) err(EX_NOINPUT, "%s", file_name); Display an error message and exit: if (tm.tm_hour < START_TIME) errx(EX_DATAERR, "too early, wait until %s", start_time_string); Warn of an error: if ((fd = open(raw_device, O_RDONLY, 0)) == -1) warnx("%s: %s: trying the block device", raw_device, strerror(errno)); if ((fd = open(block_device, O_RDONLY, 0)) == -1) err(EX_OSFILE, "%s", block_device); Warn of an error without using the global variable errno: error = my_function(); /* returns a value from <errno.h> */ if (error != 0) warnc(error, "my_function"); SEE ALSO
exit(3), fmtmsg(3), printf(3), strerror(3), sysexits(3) STANDARDS
The err() and warn() families of functions are BSD extensions. As such they should not be used in truly portable code. Use strerror() or similar functions instead. HISTORY
The err() and warn() functions first appeared in 4.4BSD. The err_set_exit() and err_set_file() functions first appeared in FreeBSD 2.1. The errc() and warnc() functions first appeared in FreeBSD 3.0. BSD
March 29, 2012 BSD
All times are GMT -4. The time now is 07:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy