12-06-2010
$ marks the end of a line (or string) if used at the end of a regular expression (match-end-of-line operator).
* means zero or more occurrences of the preceding character (repetition operator), in this case a digit ([0-9])
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
There are files on a remote server with the file name ending in "mm-dd-yy.txt". The script I am running is:
mls "Daily_Service_Text_File_*" /my/local/dir/Filelisting.txt
nawk -F_ -f file.awk /my/local/dir/Filelisting.txt | sort -k1n | cut -f2- | tail -1
It worked up too "12-31-07.txt" but... (3 Replies)
Discussion started by: bbbngowc
3 Replies
2. Shell Programming and Scripting
I found this very useful perl script that will check a remote ftp server, search for files of a specific time and get them. When I run the script it works, but it gave me the following error:
Couldn't get filename_12-13-07.txt Bad file number
What in this script would cause this? I know... (2 Replies)
Discussion started by: bbbngowc
2 Replies
3. UNIX for Dummies Questions & Answers
Hi people I am trying to learn this code and see how it relates to the old DOS days. I have a line of code that I am not sure what the first part does. Any help will be greatly appreciated.
It is from a Save command that is used to backup files to a directory.
It goes like this
if ;then... (10 Replies)
Discussion started by: coyote1967
10 Replies
4. Shell Programming and Scripting
Hi,
I have a script at the moment of which reads in simply what the latest version is within a folder i.e. v001, v002, v003 etc and then stores this latest version in a variable i.e. $LATEST would echo v003. I have then cut this string so that I only consider the 003 part. I would then like to... (3 Replies)
Discussion started by: cyberfrog
3 Replies
5. UNIX for Dummies Questions & Answers
I'm reading about command substitutions and came across this little function in my book:
function lsd
{
date=$1
ls -l |grep -i "^.\{42\}$date"|cut -c55-
}
it's a little example which is supposed to select files by modification date, given as an argument to the function.
I... (3 Replies)
Discussion started by: Straitsfan
3 Replies
6. Programming
I am trying to simplify the coding in a script I was given, but it was written 7-10 years ago and is pretty complicated. below is a tidbit, if someone can break it down for me I would appreciate it.
sub ParseText
{
my ($line, $key, $value, $sub, $script);
foreach $line (@_)... (0 Replies)
Discussion started by: callyvan
0 Replies
7. Programming
I have a string, eg 7f30.3 and I want to store things in the following way
npos = 7
decform = true
width = 30
ndp = 3
I need to read each character one by one. I am coding in fortran but I can try to code it should answer be given in C in the above way. (2 Replies)
Discussion started by: kristinu
2 Replies
8. Shell Programming and Scripting
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
9. UNIX for Beginners Questions & Answers
Dear experts,
I am a relative novice in the Unix and came across a very useful code that I regularly use for my research blindly. I am wondering if any of the professional members could kindly briefly explain to me what the code actually does?
Many thanks in advance
The script is
awk... (4 Replies)
Discussion started by: arsalane
4 Replies
LEARN ABOUT BSD
vgrindefs
VGRINDEFS(5) File Formats Manual VGRINDEFS(5)
NAME
vgrindefs - vgrind's language definition data base
SYNOPSIS
/usr/share/misc/vgrindefs
DESCRIPTION
Vgrindefs contains all language definitions for vgrind. The data base is very similar to termcap(5).
FIELDS
The following table names and describes each field.
Name Type Description
pb str regular expression for start of a procedure
bb str regular expression for start of a lexical block
be str regular expression for the end of a lexical block
cb str regular expression for the start of a comment
ce str regular expression for the end of a comment
sb str regular expression for the start of a string
se str regular expression for the end of a string
lb str regular expression for the start of a character constant
le str regular expression for the end of a character constant
tl bool present means procedures are only defined at the top
lexical level
oc bool present means upper and lower case are equivalent
kw str a list of keywords separated by spaces
Example
The following entry, which describes the C language, is typical of a language entry.
C|c: :pb=^d?*?d?pd?a?:bb={:be=}:cb=/*:ce=*/:sb=":se=e":
:lb=':le=e':tl:
:kw=asm auto break case char continue default do double else enum
extern float for fortran goto if int long register return short
sizeof static struct switch typedef union unsigned while #define
#else #endif #if #ifdef #ifndef #include #undef # define else endif
if ifdef ifndef include undef:
Note that the first field is just the language name (and any variants of it). Thus the C language could be specified to vgrind(1) as "c"
or "C".
Entries may continue onto multiple lines by giving a as the last character of a line. Capabilities in vgrindefs are of two types: Bool-
ean capabilities which indicate that the language has some particular feature and string capabilities which give a regular expression or
keyword list.
REGULAR EXPRESSIONS
Vgrindefs uses regular expression which are very similar to those of ex(1) and lex(1). The characters `^', `$', `:' and `' are reserved
characters and must be "quoted" with a preceding if they are to be included as normal characters. The metasymbols and their meanings
are:
$ the end of a line
^ the beginning of a line
d a delimiter (space, tab, newline, start of line)
a matches any string of symbols (like .* in lex)
p matches any alphanumeric name. In a procedure definition (pb) the string that matches this symbol is used as the procedure name.
() grouping
| alternation
? last item is optional
e preceding any string means that the string will not match an input string if the input string is preceded by an escape character
(). This is typically used for languages (like C) which can include the string delimiter in a string b escaping it.
Unlike other regular expressions in the system, these match words and not characters. Hence something like "(tramp|steamer)flies?" would
match "tramp", "steamer", "trampflies", or "steamerflies".
KEYWORD LIST
The keyword list is just a list of keywords in the language separated by spaces. If the "oc" boolean is specified, indicating that upper
and lower case are equivalent, then all the keywords should be specified in lower case.
FILES
/usr/share/misc/vgrindefs file containing terminal descriptions
SEE ALSO
vgrind(1), troff(1)
AUTHOR
Dave Presotto
BUGS
4.2 Berkeley Distribution October 22, 1996 VGRINDEFS(5)