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

  • Home
  • SEARCH
  • 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 7520393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:03:46+00:00 2026-05-30T02:03:46+00:00

After half an hour searching for an answer to this, I can’t think of

  • 0

After half an hour searching for an answer to this, I can’t think of a way to do it (without it involving opening each text file individually, selecting all and then lowercase-ing with gedit. I would like to be able to run a script, be it by commandline or preferably to include into nautilus-scripts, so that if I select the files on the GUI and rightclick to scripts and lowercase and it will be done.
I know that tr is able to know how to do it, but I can’t figure out how can I turn the following call to tr '[:upper:]' '[:lower:]' < input.txt > output.txt Normally, I would change input.txt to *.txt and *.txt for output.txt, but it doesn’t work. Any ideas?

Extra: once that is solved, how to adapt it for nautilus-scripts? :]

Thanks!

  • 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-30T02:03:47+00:00Added an answer on May 30, 2026 at 2:03 am

    Edit:
    This turned out to be an encoding issue – the OP’s input files are UTF16.

    After a discussion in the comments, the OP copy/pasted the data from viewing with less into a pastebin: http://pastebin.com/uHmYmhpT

    It looked like this:

    <FF><FE>1^@^M^@
    ^@0^@0^@:^@0^@0^@:^@0^@9^@,^@4^@4^@2^@ ^@-^@-^@>^@ ^@0^@0^@:^@0^@0^@:^@1^@1^@,^@4^@4^@4^@^M^@
    ^@j& ^@W^@O^@K^@E^@ ^@U^@P^@^M^@
    ^@T^@H^@I^@S^@ ^@M^@O^@R^@N^@I^@N^@G^@ ^@j&^M^@
    ^@^M^@
    ^@2^@^M^@
    

    … and so on.

    This is clearly not an ascii (or utf8) text file, and so most standard tools (sed, grep, awk, etc) will not work on it.

    The <FF><FE> at the start is a Byte Order Mark that indicates that this file is UTF16-encoded text. There is a standard tool for converting between UTF16 and UTF8, and UTF8 is compatible with ascii for alphanumeric characters so if we convert it to UTF8, then sed/grep/awk/etc will be able to edit it.

    The tool we need is iconv. Unfortunately, iconv has no in-place editing feature so we’ll have to write a loop that uses a temporary file to do the conversion:

    find . -type f -name '*.srt' -print0 | while read  -d '' filename; do
        if file "$filename"|grep -q 'UTF-16 Unicode'; then
            iconv -f UTF16 -t UTF8 -o "$filename".utf8 "$filename" && mv "$filename".utf8 "$filename"
        fi
    done
    

    Then you can run the find/sed command to lowercase them. Most programs won’t care that your files are now UTF8 rather than UTF16, but if you have issues then you can write a similar loop that uses iconv to put them back into UTF16 after you’ve lowercased them.


    If you just want to lowercase all files matching ‘*.txt’:

    sed -i 's/.*/\L&/' *.txt
    

    But note that this will run into issues with the command line length if there’s a lot of .txt files.

    If you want to do lowercasing on all files recursively, I’d use Diego’s approach – but there’s a couple of errors to fix:

    find . -type f -exec sed -i 's/.*/\L&/' {} +
    

    should do the trick.

    If you don’t want it to be recursive, you want it to only affect ‘.txt‘ files, and you’ve got too many files for the sed ... *.txt to work, then use:

    find . -maxdepth 1 -type f -name '*.txt' -exec sed -i 's/.*/\L&/' {} +
    

    (-maxdepth 1 stops the recursion)

    Older versions of find won’t support the -exec ... + syntax, so if you run into trouble with that then replace the + with \;. The + is preferable because it makes find invoke sed with multiple files per invocation, rather than once per file, so it’s slightly more efficient.

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

Sidebar

Related Questions

After spending half an hour to find a proper, self-explaining title for this question,
After searching around the web for about half an hour i've decided to ask
I've spent half an hour trying to get this, maybe someone can come up
Believe me or not but after searching the web for half an hour I
Today, after half an hour of searching for a bug, I discovered that it
If this has been asked before I sincerely apologize. After around half an hour
I've literally spent the past half hour searching for the solution to this, and
So after about a day and a half with this I've made zero progress.
im trying to customize this page indicator with half succes, but after many hours
I would like to call a function after every half an hour in background.

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.