Sponsored Content
Top Forums Shell Programming and Scripting Help parsing filename with bash script Post 302487402 by mtehonica on Wednesday 12th of January 2011 10:08:30 AM
Old 01-12-2011
Quote:
Originally Posted by zaxxon
Example with GNU awk on Linux:

Code:
$> echo livingroom-110111105637.avi| awk -F"[-.]" '{d=substr($2,0,6); h=substr($2,6,2); m=substr($2,8,2);s=substr($2,10,2); print $1"-"d"-"h"."m"."s"."$3}'
livingroom-110111-11.05.63.avi

If "-" is not always the delimeter between name and date/time, you might want to modify this to your needs.
Amazing! Thank you very much! Looks like it's off by 1 position though, the 7 at the end is cut off, the output for that example should be "livingroom-110111-10.56.37.avi"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Conversion of bash parsing script to perl?

I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
Discussion started by: cstovall
2 Replies

2. UNIX for Dummies Questions & Answers

bash script to increment a digit in filename

Hi guys, Can someone help me out with this: I have a directory with files like the following, GHost++ 2010-03-14 04-01 DotaCash RD us_ca LC #7 (44m19s).w3g GHost++ 2010-03-14 04-06 DotaCash AP us_ca LC #8 (42m24s).w3g GHost++ 2010-03-14 04-07 DotaCash AR us_ca LC #10 (08m23s).w3g ... (4 Replies)
Discussion started by: hbjlee17
4 Replies

3. Shell Programming and Scripting

URGENT!!! bash script to sort files into folder according to a string in the filename

Hi all. I am very new to linux scripting and i have a task i can only solve with a script. I need to sort files base on the date string in their filenames and create a folder using the same date string then move the files to their respective folders. Scenario: Folder Path:... (1 Reply)
Discussion started by: ace47
1 Replies

4. Shell Programming and Scripting

Bash script to sort files into folder according to a string in the filename

Hi all. I am very new to linux scripting and i have a task i can only solve with a script. I need to sort files base on the date string in their filenames and create a folder using the same date string then move the files to their respective folders. Scenario: Folder Path:... (1 Reply)
Discussion started by: ace47
1 Replies

5. Shell Programming and Scripting

Column parsing in a bash script - HELP

I would like to setup a script that pulls in time/date in two seperate columns, and then name the other columns as listed below: Column1=Art/TJ output Column2=Art/TJ output Column3=TJ output column4=Art output Column5=If time/date past 12:00 noon -fail Colume6=If time/date before... (1 Reply)
Discussion started by: walnutpony123
1 Replies

6. Shell Programming and Scripting

How to Pass filename to AWK in bash script

I have written a script which works fine, to remove patterns contained in EXCLUDE.DAT from input.txt awk 'BEGIN {n=0;while (getline < "EXCLUDE.DAT" > 0){ex=$0;n++}} {for(var in ex){print var "-" ex $0 ;i++}}' input.txt The last problem I need to solve is how to pass the file... (3 Replies)
Discussion started by: nixie
3 Replies

7. Shell Programming and Scripting

Bash script not parsing file with spaces in path

Hi everyone, I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
Discussion started by: gjws
2 Replies

8. Shell Programming and Scripting

Parsing and Editing a json file with bash script

I am trying to automate editing of a json file using bash script. The file I initially receive is { "appMap": { "URL1": { "name": "a" }, "URL2": { "name": "b" }, "URL3": { "name": "c" }, } WHat I would like to do is replace... (5 Replies)
Discussion started by: Junaid Subhani
5 Replies

9. UNIX for Beginners Questions & Answers

Bash script - Remove the 3 top level of a full path filename

Hello. Source file are in : /a/b/c/d/e/f/g/some_file Destination is : /d/e where sub-directories "f" and "g" may missing or not. After copying I want /a/b/c/d/e/f/g/file1 in /d/e/f/g/file1 On source /a is top-level directory On destination /d is top-level directory I would like... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

Replacing filename with sed in bash script

I need to cat two files with similar names. I am using the following script: #!/bin/bash if ] then file=$1 file2="${file%R1.fastq}R2.fastq" echo fetching data from R2 file ... sleep 3 cat $file $file2 > infile else echo "Input_file passed... (2 Replies)
Discussion started by: Xterra
2 Replies
yuvkineco(1)							MJPEG tools manual						      yuvkineco(1)

NAME
yuvkineco - revert 2-3 pulldown movie SYNOPSIS
yuvkineco [options] [-C PATH] yuvkineco [options] -O|N PATH DESCRIPTION
yuvkineco reverts to original non-interlaced frames, from NTSC video which was film sourced and 2-3 pulled down. Input fps code must be 4(29.97fps), output fps code can be selected from 1(23.97fps) to 4(29.97fps). If 2, 3 or 4 selected, duplicated frames remain but they are reverted to non-interlaced. If input was non-interlaced only remove duplicate frames. Interlaced frame detection may fail in conditions like: Pull down cycle changed (video editing). Low quality pull down. Motionless scene. If -C PATH was specified, yuvkineco outputs 2-3 pull down cycle list to the file. You can edit this file by hand and feed it to yuvkineco with -O or -N option to correct mistake of 1st yuvkineco. Try -C and see cycle list. EXAMPLE #1: for 24p movie / automatically lav2yuv 60i.eli | yuvkineco -F 1 | yuv2lav -f a -I 0 -o 24p.avi EXAMPLE #2: for 30p/24p mix / automatically lav2yuv 60i.eli | yuvkineco -F 4 | yuv2lav -f a -I 0 -o 30p.avi EXAMPLE #3: for 24p movie / check and repair lav2yuv 60i.eli | yuvkineco -F 1 -C 60i.23c | yuv2lav -f a -I 1 -o take1.avi glav -F +n take1.avi # check and edit 60i.23c lav2yuv take1.avi | yuvkineco -F 1 -N 60i.23c | yuv2lav -f a -I 0 -o take2.avi EXAMPLE #4: for 24p movie / check and retry lav2yuv 60i.eli | yuvkineco -F 1 -C 60i.23c | yuv2lav -f a -I 0 -o take1.avi glav -F +n take1.avi # check and edit 60i.23c lav2yuv 60i.eli | yuvkineco -F 1 -O 60i.23c | yuv2lav -f a -I 0 -o take2.avi OPTIONS
yuvkineco accepts the following options: -F FPSCODE Set output fps code (default: same as input). -C PATH Specify 2-3 pull down cycle list file name to write. -O PATH Specify cycle list name to read with old yuv stream to retry. -N PATH Specify cycle list name to read with new yuv stream to repair. -S MIN Use yuvycsnoise(1) as preprocessor and specify minimum threshold. -n LEVEL Specify noise level of input (default: 10). This affects both pulldown cycle detection and deinterlacing. -c THRESHOLD Specify threshold to decide pictures in 2 frames are same (default: 4). yuvkineco compares several frames, searches pair of frame they contain same pictures, to decide which frame should be dropped. If THRESHOLD is 0, pair which has smallest difference will be selected. If 16, selected from pairs those have differences smaller than average. -i PERMIL yuvkineco deinterlaces each frame after 2-3 pulldown reverting process, specify how much pixels deinterlaced to decide to use or not use deinterlacing result (default: 10). If PERMIL is 10 and 1% or more of pixels deinterlaced, deinterlacing result will be used. If 0, always deinterlacing result will be used. If 1000, deinterlacing result will not be used, but deinterlacing process will run on all of frames. To disable deinterlacing process, specify negative value. -u Set interlace information in header of output to unknown (default: non-interlaced). AUTHOR
yuvkineco was written by Kawamata/Hitoshi. If you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is: mjpeg-users@lists.sourceforge.net For more info, see our website at http://mjpeg.sourceforge.net/ SEE ALSO
mjpegtools(1), yuvycsnoise(1). MJPEG Linux Square 5 February 2002 yuvkineco(1)
All times are GMT -4. The time now is 03:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy