Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7497209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:58:48+00:00 2026-05-29T18:58:48+00:00

Here is the script that I want to run using git filter-branch : #!/bin/bash

  • 0

Here is the script that I want to run using git filter-branch:

#!/bin/bash
if test -e src/unlagged.cpp; then
    more +34 src/unlagged.cpp | cat ~/newlic.cpp.txt - > /tmp/unlagged.cpp
    cp /tmp/unlagged.cpp src/unlagged.cpp
fi
if test -e src/unlagged.h; then
    more +34 src/unlagged.h | cat ~/newlic.h.txt - > /tmp/unlagged.h
    cp /tmp/unlagged.h src/unlagged.h
fi

Pretty simple. It takes everything past the first 34 lines of src/unlagged.cpp and src/unlagged.h, concatenates it with the contents of a text file, then writes it out to a temporary file, which is then copied on top of the file I wished to modify. This works great as long as I’m simply running it inside my source tree, as the output of src/unlagged.cpp looks like:

(newlic.cpp.txt)
(everything passed line 34 of src/unlagged.cpp)

However, when I run git filter-branch '/path/to/script.sh' -- --all, the files are modified thusly…

(newlic.cpp.txt)
::::::::::::::
src/unlagged.cpp
::::::::::::::
(entire src/unlagged.cpp)

Where did those colons and the name of the file come from? Why didn’t it actually trim src/unlagged.cpp? I tried the script with #!/bin/sh and got the same result. I’m using git 1.7.7.3, by the way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:58:49+00:00Added an answer on May 29, 2026 at 6:58 pm

    Use tail -n +34 instead of more +34. You are being interfered with by the interactive nature of more. As an example, run more +34 src/unlagged.cpp < /dev/null and you will see the :::::::::: lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, my goal is to test the code given here: PHP script that
Here is my script: #!/bin/bash echo Digite o local em que deseja instalar o
I want to run perl -w using env . That works fine on the
I'm using mongoose in a script that is not meant to run continuously, and
I wrote a Ruby script that I want to run in the background repeatedly
I wrote a bash script that gets output from a website using curl and
I found a perl script that manages randomizing the wikipedia articles in Wikipedia here
I'm writing a script that will ping my ip range. Here's what I have
I was sitting here wondering if it's possible to write a greasemonkey script that
First post, so here goes. I'm writing a script that does intelligent search and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.