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 7437269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:22:22+00:00 2026-05-29T10:22:22+00:00

Following the instructions at Add header (copyright) information to existing source files , I

  • 0

Following the instructions at Add header (copyright) information to existing source files, I need to add copyright headers to a bunch of source files we’re sending out of the building. (I know, I hate copyright headers too, but it’s policy for when we release proprietary source files. Please consider “persuade someone to waive the policy” as unhelpful and as not answering the question.)

I have two copies of all the files (in dir and dir.orig) and, from within dir.orig, I’m using

find . -name \*.cs -exec sh -c "mv '{}' tmp && cp ../header.txt '../dir/{}'
  && cat tmp >> '../dir/{}' && rm tmp" \;

This is working, but it’s ending up with the header, then the BOM from the original source file, whereas I’d prefer either the BOM to move to the start or be removed.

(Looking at this, I realise that moving the file to tmp is unnecessary, given I’m not overwriting the original, but I didn’t bother removing that from the example from the other SO question.)

How can I remove (or move) the BOM so that I end up without it appearing immediately after the newly-added header?

  • 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-29T10:22:23+00:00Added an answer on May 29, 2026 at 10:22 am

    I think I may have found my solution, thanks to being pointed to uconv from this answer from Steven R. Loomis on a related question.

    If I use

    find . -name *.cs -exec sh -c "cp ../header.txt '../dir/{}'
      && uconv --remove-signature -f UTF-8 -t UTF-8 '{}' >> '../dir/{}'" \;
    

    , then uconv assumes both input (-f) and output (-t) encodings should be UTF-8, but --remove-signature causes it to remove any BOM it finds.

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

Sidebar

Related Questions

Anyone out there using the FTUtils library for iPhone development? Following the instructions here
I'm following the instructions at: http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids to add the tag cloud to my view:
I'm trying to access out-of-network profiles using the LinkedIn API, following the instructions from
I'm trying to add activeadmin to my rails 3.0.3 app. I'm following the instructions
I added custom fonts by following some instructions suggesting add them to plist.info under
I have followed the following instructions in setting a git repository locally in one
I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls |
I have installed GDB 7.0 and python per the following instructions . In the
Tried following the instructions here: How to use Google app engine with my own
Today I was following some instructions to install a software in Linux. There was

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.