Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Testing Var for 3 digits in a row only Post 302339928 by fpmurphy on Friday 31st of July 2009 10:09:39 PM
Old 07-31-2009
Quote:
Note that this will ONLY work in bash, not ksh or anything, since only bash has regex support like this.
Works perfectly well with ksh93 although the more common way is as follows
Code:
if [[ $STR == {3}([[:digit:]]) ]]
then
    print "Three digits"
fi

 

10 More Discussions You Might Find Interesting

1. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

2. Shell Programming and Scripting

help: single digits inflated to 2 digits

Hi Folks Probably an easy one here but how do I get a sequence to get used as mentioned. For example in the following I want to automatically create files that have a 2 digit number at the end of their names: m@pyhead:~$ for x in $(seq 00 10); do touch file_$x; done m@pyhead:~$ ls file*... (2 Replies)
Discussion started by: amadain
2 Replies

3. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

4. UNIX for Advanced & Expert Users

Testing privileges -lock lockfile /var/lock/subsys/..- Permission denied

Hi all, I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...). I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message. Is there any way to simply get a return code... (3 Replies)
Discussion started by: Dedalus
3 Replies

5. Shell Programming and Scripting

Find filenames with three digits and add zeros to make five digits

Hello all! I've looked all over the internet and this site and have come up a loss with an easy way to make a bash script to do what I want to do. I have a file with a naming convention as follows: 2012-01-18 string of words here 123.jpg 2012-01-18 string of words here 1234.jpg 2012-01-18... (2 Replies)
Discussion started by: Buzzman25
2 Replies

6. Shell Programming and Scripting

Remove duplicates and update last 2 digits of the original row with 0's

Hi, I have a requirement where I have to remove duplicates from a file based on the first 8 chars (It is fixed width file of 10 chars length) and whenever a duplicate row is found, its original row's last 2 chars should be updated to all 0's. I thought of using sort -u -k 1.1,1.8... (4 Replies)
Discussion started by: farawaydsky
4 Replies

7. Shell Programming and Scripting

Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have ) so i found out i can't do : set string_buff = "" foreach line("`cat $source_dir/$f`") $string_buff = string_buff $line end how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies

8. Shell Programming and Scripting

Add Row from First Row (Split Row)

HI Guys, I have Below Input :- RepigA_hteis522 ReptCfiEtrBsCll_aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 RepigA ReptCfiEtrBsCll hteis522 aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 Split Data in two first row... (2 Replies)
Discussion started by: pareshkp
2 Replies

9. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

Hi ALL, We have requirement in a file, i have multiple rows. Example below: Input file rows 01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212 01,1,102319,0,1,80,20,U,1,241,00000059420000006021 I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies

10. UNIX for Beginners Questions & Answers

sed / awk script to delete the two digits from first 3 digits

Hi All , I am having an input file as stated below 5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011 611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011 3486... (4 Replies)
Discussion started by: kshitij
4 Replies
RUN-PARTS(8)						      System Manager's Manual						      RUN-PARTS(8)

NAME
run-parts - run scripts or programs in a directory SYNOPSIS
run-parts [--test] [--verbose] [--report] [--lsbsysinit] [--regex=RE] [--umask=umask] [--arg=argument] [--exit-on-error] [--help] [--ver- sion] [--list] [--reverse] [--] DIRECTORY run-parts -V DESCRIPTION
run-parts runs all the executable files named within constraints described below, found in directory directory. Other files and directo- ries are silently ignored. If neither the --lsbsysinit option nor the --regex option is given then the names must consist entirely of ASCII upper- and lower-case let- ters, ASCII digits, ASCII underscores, and ASCII minus-hyphens. If the --lsbsysinit option is given, then the names must not end in .dpkg-old or .dpkg-dist or .dpkg-new or .dpkg-tmp, and must belong to one or more of the following namespaces: the LANANA-assigned namespace (^[a-z0-9]+$); the LSB hierarchical and reserved namespaces (^_?([a-z0-9_.]+-)+[a-z0-9]+$); and the Debian cron script namespace (^[a-zA-Z0-9_-]+$). If the --regex option is given, the names must match the custom extended regular expression specified as that option's argument. Files are run in the lexical sort order (according to the C/POSIX locale character collation rules) of their names unless the --reverse option is given, in which case they are run in the opposite order. OPTIONS
--test print the names of the scripts which would be run, but don't actually run them. --list print the names of the all matching files (not limited to executables), but don't actually run them. This option cannot be used with --test. -v, --verbose print the name of each script to stderr before running. --report similar to --verbose, but only prints the name of scripts which produce output. The script's name is printed to whichever of stdout or stderr the script first produces output on. --reverse reverse the scripts' execution order. --exit-on-error exit as soon as a script returns with a non-zero exit code. --lsbsysinit use LSB namespaces instead of classical behavior. --new-session run each script in a separate process session. If you use this option, killing run-parts will not kill the currently running script, it will run until completion. --regex=RE validate filenames against custom extended regular expression RE. See the EXAMPLES section for an example. -u, --umask=umask sets the umask to umask before running the scripts. umask should be specified in octal. By default the umask is set to 022. -a, --arg=argument pass argument to the scripts. Use --arg once for each argument you want passed. -- specifies that this is the end of the options. Any filename after -- will be not be interpreted as an option even if it starts with a hyphen. -h, --help display usage information and exit. -V, --version display version and copyright and exit. EXAMPLES
Print the names of all files in /etc that start with `p' and end with `d': run-parts --list --regex '^p.*d$' /etc COPYRIGHT
Copyright (C) 1994 Ian Jackson. Copyright (C) 1996 Jeff Noxon. Copyright (C) 1996, 1997, 1998 Guy Maor Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Clint Adams run-parts is free software; see the GNU General Public License version 2 or later for copying conditions. There is no warranty. Debian 27 Jun 2012 RUN-PARTS(8)
All times are GMT -4. The time now is 03:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy