Sponsored Content
Top Forums Shell Programming and Scripting help removing characters for output file in shell script Post 302220872 by wingchun22 on Friday 1st of August 2008 11:23:05 PM
Old 08-02-2008
help removing characters for output file in shell script

hi i'm new to shell scripts and have a small problem

i am running a batch converter that returns all flash .flv files in a directory and create a png image from each one

Quote:
#!/bin/bash
echo "flv-to-png converter"
echo ""
if (($# ==0))
then
echo "Usage: flvtopng [flv files] ..."
exit
fi
while (($# !=0 ))
do
ffmpeg -i $1 -vcodec png -vframes 1 -an -ss 00:00:08 -t 00:00:01 -f rawvideo -s 320x240 /var/www/vhosts/mysite.com/httpdocs/playerimage/$1.png
shift
done
echo "Finished with flv-to-png converter"
echo ""
the problem i have is the $1 variable , its ok on the first call but on the secound call $1.png , i have extra characrters that i need to strip from this element

for example on the first call of $1 it produces 997.flv on the secound call $1.png and outputs a resulting 997.flv.png

i need to strip the .flv part from 997.flv.png to return only 997.png (strip 4 characters from the end of $1 on its secound call - this whould be the same on all resulting files in a directory full of files as this shell script runs)

how can i do this, is it easy or is it complex, any help with this issue would be very usefull, i have tryed searching google, but can not fing out how to strip characters from a varablie in shell scripts

thanks in advance

Last edited by wingchun22; 08-02-2008 at 12:28 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing certain characters in a file

Hi I have a file that has semicolons in it (;) is there a way to just remove these in the file. Example name: Joe Smith; group: Group1; name: Mary White; group: Group2; (2 Replies)
Discussion started by: bombcan
2 Replies

2. Shell Programming and Scripting

Bold characters in a file using Shell script

Hi, When I am running below mentioned script then the characters become bold but after opening the same file in Windows, Instead of getting bold characters i am getting some garbage value for \033Kunal Dixit Output in Windows (after ftp the file): but in windows , i am getting My name is... (0 Replies)
Discussion started by: kunal_dixit
0 Replies

3. Shell Programming and Scripting

Removing the entire file contents using unix shell script.

I need to remove the entire file contents in file using the shell script. Actually the grap -v command will create one more file and it occupy the space also. I need to remove the entire file contents without creating new file using the shell scripting. Please help me. (5 Replies)
Discussion started by: praka
5 Replies

4. Shell Programming and Scripting

Removing ^M characters from a file

Hi, I want to removing ^M characters from a file and combine the line with the next line. ex: issue i have: ABC^M^M DEF solution i need: ABCDEF I found that you by using the following command you can remove new line characters. tr -d '\r' < infile.csv > outfile.csv still... (10 Replies)
Discussion started by: mwrg
10 Replies

5. UNIX for Dummies Questions & Answers

shell script to find noof characters in a file name

hiiii shell script to find noof characters in a file name, when you run ls -l (using awk) I tried with this ls -l > temp awk -F"," '{print $1 " " expr length $9}' temp but it give some other value instead of file name length (error value like , 563,54,55,56....).How to prnint the... (10 Replies)
Discussion started by: krishnampkkm
10 Replies

6. Shell Programming and Scripting

Removing Characters From finger Output

Hi Does anyone know of a command that will extract only the Login name alison and year 2005 from the following output. jamesm> finger alison Login name: alison In real life: Alison Smith - Queensland Directory: /data/home/alison Shell: /usr/bin/ksh... (2 Replies)
Discussion started by: jamba1
2 Replies

7. Shell Programming and Scripting

Removing lines from a file being used by another process using SHELL script

Hi All, Need a small help in writing a shell script which can delete a few lines from a file which is currently being used by another process. File gets appended using tee -a command due to which its size is getting increased. Contents like : 25/09/2012 05:18 Run ID:56579677-1 My... (3 Replies)
Discussion started by: nikhil8
3 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Removing control-m characters from shell script

Hi All, I need to remove control m character from a file. Steps which i am doing in shell script are: 1) We are comparing the header of the file to the database table header Here the file header has control-m characters. How do i remove it. Please help. Below are the steps i am using,... (12 Replies)
Discussion started by: abhi_123
12 Replies

9. Shell Programming and Scripting

Removing last and first characters in a file

bash-3.00$ cat temp.txt ./a/REA01/ces1/apps/ces_ces1_init3_aa.ear/ces.war/WEB-INF/classes/reds/common/environment.properties ./a/REA01/ces1/apps/ces_ces1_init3_aa.ear/commonproperties/hi/HostIntegration.properties... (9 Replies)
Discussion started by: bhas85
9 Replies

10. Shell Programming and Scripting

Removing characters and some output

Hi guys, So I am using an awk command to return a specific column in a file. I also need to remove some extra characters. What I have is :: (http-/0.0.0.0:8091-9)|23:00:41 And what I want is : http-/0.0.0.0:8091-9 I tried using the td command but it is only removing the ( ,... (5 Replies)
Discussion started by: Junaid Subhani
5 Replies
img-png(n)																img-png(n)

__________________________________________________________________________________________________________________________________________________

NAME
img-png - Img, Portable Network Graphics format (png) SYNOPSIS
package require Tk package require img::png ?1.4? image create photo ?name? ?options? _________________________________________________________________ DESCRIPTION
The package img::png is a sub-package of Img. It can be loaded as a part of the complete Img support, via package require Img, or on its own, via package require img::png. Like all packages of Img it does not provide new commands, but extends the existing Tk command image so that it supports files containing raster images in the Portable Network Graphics format (png). More specifically img::png extends Tk's photo image type. The name of the new format handler is png. This handler provides new additional configuration options. See section PNG OPTIONS for more detailed explanations. All of the above means that in a call like image create photo ?name? ?options? [1] Image data in png format (options -data and -file) is detected automatically. [2] The format name png is recognized by the option -format. In addition the value for the option is treated as list and may contain any of the special options listed in section PNG OPTIONS. PNG OPTIONS
The handler provides no true options at all, but accepts pairs of keys and values when writing a PNG file. Each pair will be written as a named text chunk where the key provides the name of the chunk and the value its contents. For example png Author <name> Title <title> Description ... TRANSPARENCY
If you want to write images to disk which contain transparency information (e.g. PNG with alpha channel) you need at least Tk 8.3. SEE ALSO
img-bmp, img-dted, img-gif, img-ico, img-intro, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-raw, img-sgi, img-sun, img- tga, img-tiff, img-window, img-xbm, img-xpm KEYWORDS
image handling, png, tk COPYRIGHT
Copyright (c) 1995-2009 Jan Nijtmans <nijtmans@users.sourceforge.net> Img 1.4 img-png(n)
All times are GMT -4. The time now is 07:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy