04-04-2002
reading filenames inside a program
UNIX Sun Ultra60 5.5.1
Hello everybody, I have a problem that seems simple but turns out to be complex (for me at least). My program needs to open a directory (this part is easy), scan each filename and determine whether or not a file with the suffix (.07) exists. So the program would return true if these files existed in the specified dir:
00.01.02.03.01
01.02.01.06.02
03.06.02.06.07 <----
01.01.02.01.00
and false if the extension did not exist. I've tried looking for functions on the internet (like stat() for example) but haven't really found anything that seems like it would work. Is there a specific function that returns the filename into a given string? That would definitely solve all my problems...If anyone has any thoughts at all, I would greatly appreciate it. Thanks!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
One of my colleagues is having an issue moving files between a windows box and the AIX servers in the office.
The filenames are being truncated though i don't know to what extent. He's using Nero to burn the CD and I think he mentioned he's using Joliet.
I found another thread that shows a... (1 Reply)
Discussion started by: categoryzd
1 Replies
2. Shell Programming and Scripting
Hi,
I want to write a script to read all the filenames with extension .xml in a directory and pass the name of the file, one by one, to another function.
Please help me out.
Regards.
Saurabh (3 Replies)
Discussion started by: bhalotias
3 Replies
3. Shell Programming and Scripting
Hi,
I'm trying to write a script that reads filenames from a file and use these filenames in a loop. The filenames are all on one line and the problem is that these filenames have wildcards like * and braces like in them.
Right now what I'm doing is something like this:
echo "reading from... (0 Replies)
Discussion started by: warp17
0 Replies
4. UNIX for Dummies Questions & Answers
I am not able to read inside a while though i get the message "inside read" the cursor doesnt prompt from the console
cat file | while read ln_new_engine_dirs
do
echo "inside $ln_new_engine_dirs"
if
then
read nn
echo "inside read"
fi
done
Thanks in advance (3 Replies)
Discussion started by: ssuresh1999
3 Replies
5. UNIX for Dummies Questions & Answers
Hi I am trying read in side a do statement
but it is not working it is just printing abc before read but not stopping in abc for user input
Can anybody please help
#!/usr/bin/ksh
cat sample_file | while read ln_source3
do
param=`echo $ln_source3 | nawk... (1 Reply)
Discussion started by: ssuresh1999
1 Replies
6. Programming
hi guys
i have only basic knowledge of c so guys plz help me .....
i want 2 call c executable which requires file name as argument and i need to modify file contents before calling that executable now my question is how can i call this c executable inside another c program with arguments ??
i... (9 Replies)
Discussion started by: zedex
9 Replies
7. Shell Programming and Scripting
Hi friends,
I have small query with reg to awk search pattern..
below is my sample file and code which i tried..
$ cat file.txt
xxx,yyyyy,messageID,sha
xxxx,errorcode,messageID,name
in the above sample file - let assume I know the errorcode(2nd record) using which I want to... (2 Replies)
Discussion started by: Shahul
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
There is a process ( built in C/C++) which starts with my user id and I need to execute a specific function with a different user id. Is there any api so that I provide userid, passwd and the next instance the process will have the new user id privileges.
- Pranav (3 Replies)
Discussion started by: k_pranava
3 Replies
9. UNIX for Dummies Questions & Answers
Hello
I've got a certain no. of files in a directory whose names I'm reading and redirecting into a temporary text file using the command below:
ls -l | grep ^- | awk '{print $9}'However, whenever the file names contain spaces the above command considers only the part of the file name up to... (5 Replies)
Discussion started by: S. BASU
5 Replies
10. Shell Programming and Scripting
Hi Unix Gurus
Let's say I have the input files like the following. I need to pick the files based on my run date.
abcd_20180206.csv
abcd_20180213.csv
abcd_20180220.csv
abcd_20180227.csv
efgh_20180206.csv
efgh_20180220.csv
efgh_20180227.csv
ijkl_20180206.csv
ijkl_20180213.csv... (9 Replies)
Discussion started by: SK123
9 Replies
LEARN ABOUT BSD
mkfontscale
MKFONTSCALE(1) General Commands Manual MKFONTSCALE(1)
NAME
mkfontscale - create an index of scalable font files for X
SYNOPSIS
mkfontscale [ -b ] [ -s ] [ -o filename ] [ -x suffix ] [ -a encoding ] ... [ -f fuzz ] [ -l ] [ -e directory ] [ -p prefix ] [ -r prefix ]
[ -n prefix ] [ -- ] [ directory ] ...
DESCRIPTION
For each directory argument, mkfontscale reads all of the scalable font files in the directory. For every font file found, an X11 font
name (XLFD) is generated, and is written together with the file name to a file fonts.scale in the directory.
The resulting fonts.scale file should be checked and possibly manually edited before being used as input for the mkfontdir(1) program.
OPTIONS
-b read bitmap fonts. By default, bitmap fonts are ignored.
-s ignore scalable fonts. By default, scalable fonts are read. If -b is set, this flag has the side effect of enabling the reading of
fonts.scale files.
-o filename
send program output to filename; default is fonts.scale if bitmap fonts are not being read, and fonts.dir if they are. If filename
is relative, it is created in the directory being processed. If it is the special value -, output is written to standard output.
-x suffix
exclude all files with the specified suffix.
-a encoding
add encoding to the list of encodings searched for.
-f fuzz
set the fraction of characters that may be missing in large encodings to fuzz percent. Defaults to 2%.
-l Write fonts.dir files suitable for implementations that cannot reencode legacy fonts (BDF and PCF). By default, it is assumed that
the implementation can reencode Unicode-encoded legacy fonts.
-e specifies a directory with encoding files. Every such directory is scanned for encoding files, the list of which is then written to
an "encodings.dir" file in every font directory.
-p Specifies a prefix that is prepended to the encoding file path names when they are written to the "encodings.dir" file. The prefix
is prepended literally: if a `/' is required between the prefix and the path names, it must be supplied explicitly as part of the
prefix.
-r Keep non-absolute encoding directories in their relative form when writing the "encodings.dir" file. The default is to convert rel-
ative encoding directories to absolute directories by prepending the current directory. The positioning of this options is signifi-
cant, as this option only applies to subsequent -e options.
-n do not scan for fonts, do not write font directory files. This option is useful when generating encoding directories only.
-- end of options.
SEE ALSO
X(7), Xserver(1), mkfontdir(1), ttmkfdir(1), xfs(1), xset(1)
NOTES
The format of the fonts.scale, fonts.dir and encodings.dir files is documented in the mkfontdir(1) manual page.
Mkfontscale will overwrite any fonts.scale file even if it has been hand-edited.
mkfontscale -b -s -l is equivalent to mkfontdir.
AUTHOR
The version of mkfontscale included in this X.Org Foundation release was originally written by Juliusz Chroboczek <jch@freedesktop.org> for
the XFree86 project. The functionality of this program was inspired by the ttmkfdir utility by Joerg Pommnitz.
X Version 11 mkfontscale 1.1.0 MKFONTSCALE(1)