Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I enjoy learning how to modify files with awk, sed, and bash. However, I know it could cause issues down the road and I would like to be prepared with a log inside the file. I was thinking about how I could create a log in the footer after I modify an .html file but I am unsure how or what the process is called. I would like to be able to do as follows:

line break after the very last line of code
comment tag <!--
each item modifed on a line
end comment tag -->


<div class="example">This is before script</div>

<!--<div class="example">This is after script</div>-->

Change date 2012-12-20 13:13
Commented out example
share|improve this question
You need to be more specific about what exactly you are trying to do. If you just want revision control there are many existing tools that already exist for that, although some initial learning curve overhead might be required. – jw013 Dec 20 '12 at 19:04
@jw013 added example – Darth_Vader Dec 20 '12 at 19:20
As @ChrisDown has said, just go with a version control system. No need to reinvent existing, sophisticated wheels crudely (it takes a lot of time to implement an efficient and robust VCS). – jw013 Dec 20 '12 at 19:23
I didn't realize I needed a VCS to detect the last line. I think LOG may be a bad choice to use in this case but I am unsure on how to identify what I am trying to do. If I can figure out how to detect the last line and skip a line I can achieve what I want. – Darth_Vader Dec 20 '12 at 19:25
up vote 4 down vote accepted

It sounds like you're looking for a very crude form of revision control. You'd do better to look into using a VCS like git.

Once you've got git installed, it's fairly simple to do what you want:

git init # Initialise the new repository

# ... change some files ...

git add file1 file2                # Add files to context
git commit -m 'Changed something'  # Commit (think "restore point")

You can then see previous commits with git log and git show as appropriate.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.