To anyone who can help greetings, I am a beginner at Unix shell scripting and am researching file processing. The question I have can be done in c, however this defeats the purpose my question is as follows:
use a command-line tool named "itstat" which will display the resolution of an image file and some other lines of information. It accepts a list of image files as arguments (i.e., "itstat FILE1 FILE2 ..."), and its output looks like this: File: pet_mocap_comp_v1_tvfa_vd8.1713.jpg Resolution: 720 x 547 Channels: 3 Channel Types: RGB without Alpha Bit Depth: 8 You are in a directory with 50 randomly named and sized images, and you want to know quickly the resolution of each file. Write a script that takes no arguments and uses itstat to print the filename and resolution of each file in the current working directory in the following format: g50_comp_v6_2kfa_lg10.0310.rla: 2048 x 1556 g50_comp_v6_2kfa_lg10.0610.rla: 2048 x 1556 g50_comp_v6_2kfa_lg10.0710.rla: 2048 x 1556
I cannot find the commandline tool "itstat" and therefore do not know how to create a proper script.
Any assistance will be greatly appreciated.
This conversation is currently closed to new comments.
Googling the terms: 'itstat' and 'resolution' together didn't return any results. I think you must be following some internal documentation about an internally developed utility.
Actually I tried the same thing. Is there any way to create a perl script that will display the file names and resolutions of jpeg files in a linux environment?
These functions return information about the specified file. You do not need any access rights to the file to get this information but you need search rights to all directories named in the path leading to the file.
stat stats the file pointed to by file_name and fills in buf.
lstat is identical to stat, except in the case of a symbolic link, where the link itself is stat-ed, not the file that it refers to.
fstat is identical to stat, only the open file pointed to by filedes (as returned by open(2)) is stat-ed in place of file_name.
They all return a stat structure, which contains the following fields: {tabled display won't look right: } struct stat { dev_t st_dev; /* device */ ino_t st_ino; /* inode */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device type (if inode device) */ off_t st_size; /* total size, in bytes */ blksize_t st_blksize; /* blocksize for filesystem I/O */ blkcnt_t st_blocks; /* number of blocks allocated */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last change */ };
This sounds like some sort of class project with where you are to write a small perl script that uses a make believe command line utility. If this is the case the perl script would look like this:
This will accomplish what you need, without error checking, however, and because it is not using the FileHandle module or the my declaration it is not cleanly written.
This is, of course, perl as the title of your question implies. Also there should not be a smiley face there, but simply a ")". I must have accidentally inserted a ";" before the ")"
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Perl scripting question
I am a beginner at Unix shell scripting and am researching file processing.
The question I have can be done in c, however this defeats the purpose
my question is as follows:
use a command-line tool named "itstat" which will display the resolution of an image file and some other lines of information. It accepts a list of image files as arguments (i.e., "itstat FILE1 FILE2 ..."), and its output looks like this:
File: pet_mocap_comp_v1_tvfa_vd8.1713.jpg
Resolution: 720 x 547
Channels: 3
Channel Types: RGB without Alpha Bit
Depth: 8
You are in a directory with 50 randomly named and sized images, and you want to know quickly the resolution of each file. Write a script that takes no arguments and uses itstat to print the filename and resolution of each file in the current working directory in the following format:
g50_comp_v6_2kfa_lg10.0310.rla: 2048 x 1556 g50_comp_v6_2kfa_lg10.0610.rla: 2048 x 1556 g50_comp_v6_2kfa_lg10.0710.rla: 2048 x 1556
I cannot find the commandline tool "itstat" and therefore do not know how to create a proper script.
Any assistance will be greatly appreciated.