Rename Text in a Text File

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Rename Text in a Text File Wed Jan 27, 2021 5:42 pm • by Radkee
Is it possible for Hazel to look into a plain text file, find a word, rename it (or delete it), and save the file?

I want to write words in my file and depending on what I write, it will execute Hazel actions looking for those contents. After I write the word and Hazel does it magic, I need the word to be renamed or deleted, so it doesn’t execute again.
Radkee
 
Posts: 6
Joined: Wed Dec 09, 2015 9:05 pm

Re: Rename Text in a Text File Thu Jan 28, 2021 11:16 am • by Mr_Noodle
Hazel does not have any built-in actions to modify the contents of a file. You'll need to look into a script to do that part.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename Text in a Text File Fri Jan 29, 2021 11:37 am • by Radkee
It's good to know it's still possible! I'll research how to do this. Do you recommend a certain language to accomplish this?
Radkee
 
Posts: 6
Joined: Wed Dec 09, 2015 9:05 pm

Re: Rename Text in a Text File Fri Jan 29, 2021 12:13 pm • by Mr_Noodle
Might be doable with a regular shell script using 'sed'. You'd have to google around for examples.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support