Reg : binary files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reg : binary files
# 8  
Old 11-15-2007
By "do whatever...." I mean put in your code to add to or update in CVS. Remember with CVS to use -kb flag for binary files when you add.
# 9  
Old 11-15-2007
Quote:
Originally Posted by porter
By "do whatever...." I mean put in your code to add to or update in CVS. Remember with CVS to use -kb flag for binary files when you add.
Hi Porter,

Here my problem not with CVS.

first of all i ahve to findout the binary and test files, for that you given below script, after running i am getting error "scrip.sh: syntax error at line 5: `do' unexpected"

find dir -type f | while read N
do
case "$N" in
*.txt | *.html )
do whatever with text file "$N"
;;
*.gif | *.jpg | *.jpeg )
do whatever with binary file "$N"
;;
* )
;;
esac
done


one more doubt is "while read N" means what? here N referring to what?
# 10  
Old 11-15-2007
Quote:
Originally Posted by srujana
one more doubt is "while read N" means what? here N referring to what?
N is a variable to hold the name of the file.

Put the following as the first line of the script...

Code:
#!/bin/sh

# 11  
Old 11-15-2007
Quote:
Originally Posted by porter
N is a variable to hold the name of the file.

Put the following as the first line of the script...

Code:
#!/bin/sh

I added #!/bin/sh, still i am getting below error :
scrip.sh: syntax error at line 7: `do' unexpected

I am executing the script from /home/coradmin
# 12  
Old 11-15-2007
Tools

here
find dir -type f | while read N

dir: is the specific location where you need to place the directory

N: is the variable in which u need to place the type of file (.jpg;.txt etc)
# 13  
Old 11-15-2007
replace the "do" within the case statement with "echo"
# 14  
Old 11-15-2007
Quote:
Originally Posted by porter
replace the "do" within the case statement with "echo"
Finally i got whatever i am looking ...thankq so much porter
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Binary files diff

Hi I am very happy to joined this group!!! I need your suggestion for get it resolved my issue. I have two class files both class files are same, there is no diff in both two files. Both 2 files were compiled in Linux environment with different type of OS. When i am using diff command,... (13 Replies)
Discussion started by: suresh1256644
13 Replies

2. Shell Programming and Scripting

Binary files

Hi All,Is there anyway I can conver the binary file to ascii. I don't know the binary file format. file command just lists this as "data" file and when I view it has a lot of non-printable characters.Can I write any command equivalent to wc -l to find out the number of rows in the file?Can I use... (4 Replies)
Discussion started by: rahulkav
4 Replies

3. Programming

Editing binary files

I am working in C and need a solution for below problem: I have a binary file, which needs to be edited in such a way no data is loss. For example i have to insert 3 bytes of data at some position without changing the contents of the file. if file has data as:... (2 Replies)
Discussion started by: junaid.nehvi
2 Replies

4. Solaris

doubt reg time stamp in files.

I copied a file from one host to another using sftp. But after copying the time stamp is not updating . Even though I checked the permission, it looks good. I copied the same file to some temporary location, there it updating the time stamp. Anyone have any idea on this (6 Replies)
Discussion started by: rogerben
6 Replies

5. UNIX for Dummies Questions & Answers

Reg: delete older files from ftp

Hi, I want to delete older files from ftp server. (files which are more than 5 days old). Please advice Thanks , sam (3 Replies)
Discussion started by: sam99
3 Replies

6. Shell Programming and Scripting

search for files excluding binary files

Hi All, I need a solution on my following find command find ./.. -name '*.file' -print BTW This gives me the output as belows ./rtlsim/test/ADCONV0/infile/ad0_dagctst.file ./rtlsim/test/ADCONV0/user_command.file ./rtlsim/test/ADCONV0/simv.daidir/scsim.db.dir/scsim.db.file... (2 Replies)
Discussion started by: user_prady
2 Replies

7. Shell Programming and Scripting

reg files

Dear all, One of our jobs retrieves data from tables and writes it to files. This job was running for around 15 minutes for the past 8 months. Now, this job is runnig for 45-50 minutes. I checked with the DBA's and found no issues with database. The time taken by to job to write to the file is... (5 Replies)
Discussion started by: ranj@chn
5 Replies

8. UNIX for Advanced & Expert Users

Files Linked With A Binary

Hi, What is command in unix to find what are all the files linked with an executable binary. Thanks in advance. Rgds, Omkumar (2 Replies)
Discussion started by: tc.omkumar
2 Replies

9. UNIX for Dummies Questions & Answers

Binary Files

Here's the problem... I'm using a simulator on UNIX, and it requires a filename where bits are stored, it should read them out and do whatever with them at that point.. So what i'm trying to do is make a binary file on UNIX. On my PC i can use MSDEV, or any of my C++ compilers to generate a... (2 Replies)
Discussion started by: wcRandThor
2 Replies

10. UNIX for Dummies Questions & Answers

Binary Files

Does any one know how to view a binary file as it is (in 1s and 0s) on unix environment? (1 Reply)
Discussion started by: devildivine
1 Replies
Login or Register to Ask a Question