Find Jobs
Hire Freelancers

bash sed find and replace - open to bidding

$10-30 USD

Zaprt
Objavljeno pred skoraj 8 leti

$10-30 USD

Plačilo ob dostavi
I need a bash script to do this: I have folder that contain html files and subfolders. now files name as [login to view URL], [login to view URL] etc. i want to replace the original file name with the title tag of the file ( instead of the space between the words i would like to add "_". then replace all links in all folder that contain the original name with the new title name. example of title - <title>admin/environment/php some text</title> change to <title>php_some_text</title> then to replace all links in all files that contain the old links to the new file name that will be php_some_text.html. all my needs have a solutions in my script but don't know how to replace the link all over to the new file name. my script: #!/bin/bash cd /var/www/clients/client1/web2/web/docs/31/en find . -name "*.html" > [login to view URL] while read -r filepath ; do # Considering the subfolder can have spaces, # We will start by separating the filename # And dirname folderpath=`dirname "$filepath"` filename=`basename "$filepath"` # With GNU GREP new_name=$(grep -oP '<title>\K.+?</title>' "$filepath" | sed 's#</title>##' | tr ' ' '_' ) #echo new_name=$(grep -oP '<title>\K.+?</title>' "$filepath" | sed 's#</title>##' | tr ' ' '_' ) # With BSD GREP (for who need the info) # new_name=$(grep -o '<title>.*</title>' $filepath | sed -e 's/<title>\(.*\)<\/title>/\1/g' | sed -e 's/$filename/$new_name/g' | tr ' ' '_') #if [[ $new_name = */* ]]; then echo "/${new_name##*}"; else echo "$new_name"; fi mv -v "$filepath" "$folderpath/`basename $new_name`.html" ### command that i tried to solve the link url issue #find /var/www/clients/client1/web2/web/docs -type f -exec sed -i 's/$filename/$new_name/g' {} \; #grep -rl '$filename' /var/www/clients/client1/web2/web/docs/31/en | xargs sed -i 's/$filename/$new_name/g' *.html #sed -i 's/$filename/$new_name/gi' *.html done < [login to view URL] Thank you
ID projekta: 10796706

Več o projektu

14 ponudb
Projekt na daljavo
Aktivno pred 8 leti

Želite zaslužiti?

Prednosti oddajanja ponudb na Freelancerju

Nastavite svoj proračun in časovni okvir
Prejmite plačilo za svoje delo
Povzetek predloga
Registracija in oddajanje ponudb sta brezplačna
14 freelancerjev je oddalo ponudbo s povprečno vrednostjo $37 USD za to delo
Avatar uporabnika
Hello Let's explore the requirement and kindly let us know if you would like us to share our skills & experiences with previous development. Thanks & Regards Moumita
$141 USD v 4 dneh
4,9 (60 ocen)
6,1
6,1
Avatar uporabnika
Sir, I've graduated in computing back a few years ago and been working at an ISP whee I hold a sysadmin position. As I need more money - I am back on this website. I have been usinf Linux for 7 years, Ubuntu/Debian being my favorite distribution. I have skills in BASH, Python, C, and other programming languages. My daily work is to set up and maintain servers, of all types: high availability (nginx, php-fpm, backuppc, xen, load balancing), backups, security, mail servers, setup of various things.. I also install various things for ours customers like CMS or Linux scripts / software. Please come and chat with me. I usually work on weekends so it'd be nice to begin soon :) Regards;
$35 USD v 1 dnevu
4,9 (37 ocen)
4,5
4,5
Avatar uporabnika
20+ years of programming in Unix-like operating systems like linux. I am proficient in all sorts of shell programming and can solve your problem almost immediately. Best regards, Robert
$30 USD v 1 dnevu
5,0 (2 ocen)
3,5
3,5
Avatar uporabnika
Hi, I have the piece of code you need, I did basic testing and it works. I can send it to you imediately. You can see I have passed Shell Script exam. Create a milestone with 100% amount which is 25 USD and I will send you your improved script imediately. If the script doesn't work or not fully work in the way as you specified in the project description, it will be resolved until it works flowlessly. Regards
$25 USD v 1 dnevu
5,0 (3 ocen)
3,0
3,0
Avatar uporabnika
Hello! I have experience with bash scripting. I would like to know more details. Can I make a C program for replacing the html names after changing them? I can do this in bash too. Please contact me :).
$30 USD v 0 dnevu
0,0 (0 ocen)
0,0
0,0
Avatar uporabnika
if you are olready renamed files and all what remanes is to change titles inside the html then thats all is one line command inshell using xargs and sed if nothing is done then I can write a script in 30 minutes.
$25 USD v 0 dnevu
0,0 (0 ocen)
0,0
0,0
Avatar uporabnika
Sorry, but i think i can make your job done with python... I am not so familiar with bash script yet. If you don't mind, I can try to fix it. Best, Daisy
$25 USD v 1 dnevu
0,0 (0 ocen)
0,0
0,0
Avatar uporabnika
YOUR SHELL SCRIPT IS ALREADY DONE!!! Hire me and you will receive it immediately. The script was made in two versions: 1st using grep and sed; 2nd using Perl. As you can see, I am novice at Freelancer.com. This is the reason I have chosen the lowest price (I need the initials reviews and recommendations to build my reputation). I have a good experience programming with shell script in my job as a system administrator.
$10 USD v 1 dnevu
0,0 (0 ocen)
0,0
0,0
Avatar uporabnika
i am a linux developer and often creating service using shell script
$26 USD v 1 dnevu
0,0 (0 ocen)
0,0
0,0
Avatar uporabnika
I have over 15 years of text processing experience with perl, php, regular expressions, etc. This is what I do on a daily basis, and I can provide a solution in less than 1 hour.
$25 USD v 1 dnevu
0,0 (0 ocen)
0,0
0,0

O stranki

Zastava ISRAEL
Kfar saba, Israel
5,0
1
Plačilna metoda je verificirana
Član(ica) od jan. 8, 2012

Verifikacija stranke

Hvala! Po e-pošti smo vam poslali povezavo za prevzem brezplačnega dobropisa.
Pri pošiljanju vašega e-sporočila je šlo nekaj narobe. Poskusite znova.
Registrirani uporabniki Skupaj objavljenih del
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Nalaganje predogleda
Geolociranje je bilo dovoljeno.
Vaša prijavna seja je potekla, zato ste bili odjavljeni. Prosimo, da se znova prijavite.