Print filename and resolution in wrkng dir


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print filename and resolution in wrkng dir
# 1  
Old 06-07-2007
Print filename and resolution in wrkng dir

Greetings,

I am trying to write script, (preferably in sh) that will use a proprietary program to print the resolution and name of files in the current working directory in a vertical format.

I think this script will require 3 commands with variables and a pipe to the prop program, but am not sure.

This is what I have so far-

ls|while read line do resolution=`itstat|grep Resolution|cut -f2 -d:` echo "$line: $resolution"

i tried and got a syntax line error.

If someone could help me figure this out, I would be grateful.

cheers
roc
# 2  
Old 06-07-2007
Code:
ls|while read line; do resolution=`itstat|grep Resolution|cut -f2 -d:` ; echo "$line: $resolution"; done

# 3  
Old 06-07-2007
Thank You

Thank you very much!

Last edited by rocinante; 06-07-2007 at 06:48 AM..
# 4  
Old 06-07-2007
How would I use this script to print

Thanks again!

How would I use this script to send a list of the files with a given resolution to a text file?
# 5  
Old 06-07-2007
Quote:
Originally Posted by rocinante
Thanks again!

How would I use this script to send a list of the files with a given resolution to a text file?
Code:
ls|while read line; do resolution=`itstat|grep Resolution|cut -f2 -d:` ; echo "$line: $resolution" > resln_file  ; done

# 6  
Old 06-09-2007
2 questions

what shell is this script for?

for the print variable :

> resln_file

how does this take only files with a certain resolution and print them to a directory.

Last edited by rocinante; 06-09-2007 at 11:26 PM..
# 7  
Old 06-11-2007
Quote:
Originally Posted by rocinante
what shell is this script for?

for the print variable :

> resln_file

how does this take only files with a certain resolution and print them to a directory.
You can use in ksh and bash
Code:
ls|while read line; do resolution=`itstat|grep Resolution|cut -f2 -d:` ; if [ $resolution -eq 23 ]; then echo "$line: $resolution" > resln_file ; fi  ; done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get a value from a file and serach that value filename in a dir?

buddies, my requirement would be as follows, I have a file called test.txt and content of it would be yahoo gmail hotmail and i want to search a file name called "yahoo.html" (first line of test.txt) and then "gmail.html" and then "hotmail.html" in a /home/test dir. Any idea... (8 Replies)
Discussion started by: natraj005
8 Replies

2. Shell Programming and Scripting

Print filename/dir name while executing aclput using find command

Running below command , but unable to print the filename , is there way to print filename/dirname using -print option find . -type f -exec aclput -i fileacl.template {} \; (5 Replies)
Discussion started by: lalitpct
5 Replies

3. Windows & DOS: Issues & Discussions

Check dir for overly path+filename and list in txt

Well since Windows always laments over some of my files having a too long "path+filename" and it gets in the way of copying complete directory structures I would love to have a DOS Script that helps me with finding those. I already tried DCSoft Long Filename Finder but that is neither DOS based... (3 Replies)
Discussion started by: pasc
3 Replies

4. Shell Programming and Scripting

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (4 Replies)
Discussion started by: Sriranga
4 Replies

5. UNIX for Dummies Questions & Answers

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (2 Replies)
Discussion started by: Sriranga
2 Replies

6. Shell Programming and Scripting

Howto Print File Path or Print the Filename

I'm trying to clean up my samba share and need to print the found file or print the path of the image it tried to searched for. So far I have this but can't seem to get the logic right. Can anyone help point me in the right direction? for FILE in `cat list`; do if ; then ... (1 Reply)
Discussion started by: overkill
1 Replies

7. Shell Programming and Scripting

print the filename

#!/bin/ksh for files in `ls *.gz` do gunzip -c $files | awk -v s=$files -F\" '{print s","$6}' done I have tried FILENAME parameter but it did not work please help. (1 Reply)
Discussion started by: harshakirans
1 Replies

8. Shell Programming and Scripting

awk to print files in a dir between the given time stamp

hi all, i want to print all the files in a directory. between a time stamp like $8>=07:00 and $8<=09:00. please give me commands not only in awk by any other commands also. Thanks. (3 Replies)
Discussion started by: Arunprasad
3 Replies

9. Shell Programming and Scripting

using grep and print filename

Hi, I have a question on bash. Basically I would like to print a file name using bash. I am actually trying to grep a particular character in sequential files. I have alot files such that a.txt, b.txt,c.txt...etc. If I found a certain character, I would print that particular filename. I... (5 Replies)
Discussion started by: ahjiefreak
5 Replies

10. UNIX for Dummies Questions & Answers

How to get dir name tacked onto filename with ls command

hello i'm trying to figure out how to tack the directory name onto the file name when i do the ls -ltrR command please? --------------------------------------------------------------------------------- I do the following command ls -ltrR > ls.out and get the following output:... (5 Replies)
Discussion started by: bobk544
5 Replies
Login or Register to Ask a Question