LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-12-2004, 05:03 PM   #1
CrooningTard
LQ Newbie
 
Registered: Dec 2004
Posts: 9

Rep: Reputation: 0
attempiting simple bash script, help please


Greetings
Cheery Christmas, and all that

I'm an avide user of mandrake linux, currently at 10.1, and also am an avid downloader of all that the world of newsgroups have to offer.

Recently Ive been attempting to use a bash script in linux to replace a .bat file for windows, that glues a group of split files back together.

The files are split originally using one of many available programs. These programs seems to produce similar split file groups, labeled file.mpg.001, file.mpg.002, etc..

The windoz script (.bat) looks like this :

@echo off
echo.
echo.
echo Recreating the Original File From the Pieces.
copy/b "REM-Live.mpeg.001" "REM-Live.mpeg"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.002"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.003"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.004"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.005"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.006"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.007"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.008"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.009"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.010"
copy/b "REM-Live.mpg" + "REM-Live.mpeg.011"
echo.
echo All Done Joining the Files.

Ive scoured the internet, google, and this site to find a reasonable way to convert this script, or to write a custom script using bash commands, possible cp, cat, or join.
Ive had no success, and would like any help that you could offer!
I'm not an expert in bash scripting, and really need some assistance.
Cheers!
 
Old 12-12-2004, 05:51 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Check whether a
ls -l blah.mpeg.*
gives you the files in the right order.
If it does:

cat blah.mpeg.* > blah.mpg


Cheers,
Tink
 
Old 12-12-2004, 05:53 PM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
I'm not too familiar with .bat files, but what I think you want to do is this:
Code:
cat REM-Live.mpeg.001 > REM-Live.mpeg
cat REM-Live.mpeg.002 >> REM-Live.mpg
cat REM-Live.mpeg.003 >> REM-Live.mpg
and so on.

Dave
 
Old 12-12-2004, 06:26 PM   #4
CrooningTard
LQ Newbie
 
Registered: Dec 2004
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks to you both!
It turn out that either approach gets some result.
Thsnks,
I was curious to see what the equivalent linux script would be, and as it turns out, one can replace an entire .bat file of text with a single line.
This rocks!
Cheers,
Have a good week.
 
Old 12-12-2004, 06:39 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Quote:
Originally posted by CrooningTard
Thanks to you both!
It turn out that either approach gets some result.
Thsnks,
I was curious to see what the equivalent linux script would be, and as it turns out, one can replace an entire .bat file of text with a single line.
This rocks!
Cheers,
Have a good week.
Pleasure mate,

and unix/linux OWNS you... ;}

With a little knowledge and some thought with
those systems you can achieve things that would
require some heavy programming in a winDOHs-
environment ...



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple bash script lp449 Linux - Networking 3 08-02-2005 04:25 PM
Simple bash script Soulful93 Programming 1 06-04-2005 07:26 PM
Simple Bash Script Help njdownes Programming 2 03-05-2005 07:35 AM
Simple Bash Script dmedici Programming 9 12-31-2004 03:48 AM
Simple BASH script fio Linux - General 5 01-18-2003 03:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration