LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2007, 02:55 PM   #1
Sonne
LQ Newbie
 
Registered: Nov 2007
Posts: 6

Rep: Reputation: 0
add some byte to end of file with bash


I want to add a minimal amount of data at the end of a compressed file.

It would be cool if by running a command from bash, such data would be inserted at the end of the existing file.

This would also be used with large files like 50MB for example, and added data can be around 1 Byte.

In Windows the script is doing an echo of the file followed by a character and then writing everything down with >> to the existing file, so it is the same file but plus one character.

Code:
for %%x in (*.EXT) do echo.>> %%x
This example should only show the intention. It does the procedure for every file with the extension specified in the directory it runs.

I hope you understand what I mean..

Many thanks to all the linux 'experts' in advance

edit: I am afraid this belongs to Programming but I can not delete or move

Last edited by Sonne; 11-21-2007 at 03:07 PM.
 
Old 11-21-2007, 04:08 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,952

Rep: Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073
Very similar; try something like
Code:
for x in *.EXT ;  do echo "." >> $x ; done
Go to tldp.org and get the advanced bash guide (not really "advanced", but good).
 
Old 11-21-2007, 04:14 PM   #3
Sonne
LQ Newbie
 
Registered: Nov 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks a lot
 
Old 11-21-2007, 06:08 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,308

Rep: Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744
Won't that confuse the decompression algo?
 
Old 11-22-2007, 12:51 PM   #5
Sonne
LQ Newbie
 
Registered: Nov 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Won't that confuse the decompression algo?
I also was also wondering about this, but with Rar it seems to be no problem.
 
Old 11-22-2007, 09:55 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,308

Rep: Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744
weird... I'd hate to rely on that continuing to work. Why are you doing this anyway?
 
Old 11-26-2007, 11:27 AM   #7
Sonne
LQ Newbie
 
Registered: Nov 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Why are you doing this anyway?
To change the MD5 hash without new repacking.
 
Old 11-26-2007, 07:19 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,308

Rep: Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744
Why would you want to do that ??
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash programming-append single line to end of file pheasand Linux - General 4 02-28-2014 09:41 AM
Deleting empty line at end of text file in BASH human2.0 Linux - General 8 04-01-2009 02:44 AM
Add spaces to a file using bash orfeo Linux - Newbie 5 05-28-2007 10:34 AM
end of file in bash shell manojg Linux - Newbie 4 03-09-2006 10:11 AM
Add file content to a variable (bash)? LinuxSeeker Programming 4 12-19-2005 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:05 PM.

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