The standards specify that a shell should replace each pathname matching pattern with a list of pathnames that match that pattern printed in collation sequence order.
When in that directory, what output do you get from the commands:
and please tell us what shell and operating system you're using.
One would expect the type of problem you're experiencing if some non-printing characters were being matched by the asterisk in one or more of your filenames or if the dates shown in your example were in MMDDYYYY format instead of in YYYYMMDD format (as in 01012019 comes before 12252018; but 20181225 comes before 20190101 as you want it to).
I would like to process a list of files matching: GPS*\.xyz with an awk script. I would then like to output the files to GPS*\.xyz.out (e.g. the same file name appended with .out). Something like:
awk '{if(NR==1) {offset=-$1}; $1=$1+offset; print }' GPS*.xyz
this does exactly what I want EXCEPT... (3 Replies)
I am on HP-UX and I am trying to come up with a method to call in a list of files named like so.
filename020107.dat filename020207.dat filename020307.dat
Obviously I can list them ls them like so, ls filename*.dat. In case you did not notice the number is a date and I was hoping to match... (4 Replies)
How can I pass in an argument such as "*.k" to a bash script
without having to double-quote *.k and not having *.k
`glob` to match all files in the pattern?
I tried using noglob in my script but this didn't work the way I thought
it would.. expansion is still occuring, $# is higher than I... (3 Replies)
Hi,
I have a requirement where i need to write a script to create the new file from the given input file with the data in reverse order (bottom to top)
Sample data:
Input File--------------
Java
VB
Oracle
Teradata
Informatica
Output file:-----------------
Informatica
Teradata
Oracle... (3 Replies)
My script(3 arguments $1 = folder,$2 extension,$3 string) should do the following things:
-Enter in the folder of $1(if exists).
-Put ls *.$2 > temp.txt ( I use a temp file to store the result of ls command and if $2 = txt in this file I'll have all the .txt files of the folder)
-Now I want to... (2 Replies)
Hi guys,
Here is a simple script. It writes the current time to specific files in a directory.
The arguments are the names of the files to write the date to (without path nor extension).
root:~# cat /usr/local/bin/dummy.sh
#!/bin/sh -e
for file in $@; do
date >> /var/lib/$file.dat... (11 Replies)
hi guys,
jus some file globbing questions
sed "s/^.*on//"
what does the full stop and asterisk means?
i onli know that ^ means inverse or not (1 Reply)
Hello,
I am trying to replace the position of each row by the next row.
OS: Ubuntu 18.04, bionic
I'd appreciate your help.
input_file:
-O fileA
wget http://x.y.z./a
-O fileB
wget http://a.b.c./d
-O fileC
wget http://q.f.s/t
..
..
..
-O fileZZ
wget http://r.t.y/u
I expect: (6 Replies)
Discussion started by: baris35
6 Replies
LEARN ABOUT HPUX
fnmatch
fnmatch(3C)fnmatch(3C)NAME
fnmatch() - match filename patterns
SYNOPSIS DESCRIPTION
performs pattern matching as described in regexp(5) under By default, the rule qualifications for filename expansion do not apply; i.e.,
periods (dots) and slashes are matched as ordinary characters. This default behavior can be modified by using the flags described below.
The flag argument modifies the interpretation of pattern and string. If which is defined in is set in flag, a slash character in string
must be explicitly matched by a slash in pattern; it cannot be matched by either the asterisk or question mark special characters or by a
bracket expression.
If is set in flag, a leading period must be explicitly matched. It will not be matched by a bracket expression, question mark or asterisk.
By default, a period is leading if it is the first character in string. If is set in flag, a period is leading if it is the first charac-
ter in string or immediately follows a slash.
If is not set in flag, a backslash character in pattern followed by any other character matches that second character in string. In par-
ticular, matches a backslash in string. If is set, a backslash character is treated as an ordinary character.
If flag is zero, the slash character and the period are treated as regular characters. If flag has any other value, the result is unde-
fined.
RETURN VALUE
If string matches the pattern specified by pattern, returns zero. Otherwise, returns non-zero.
EXAMPLE
The following excerpt uses to check each file in a directory against the pattern
pattern = "*.c";
while(dp = readdir(dirp)){
if((fnmatch(pattern, dp->d_name,0)) == 0){
/* do processing for match */
...
}
}
AUTHOR
was developed by OSF and HP.
SEE ALSO sh(1), glob(3C), thread_safety(5).
STANDARDS CONFORMANCE fnmatch(3C)