Find Jobs
Hire Freelancers

bash sed find and replace - open to bidding

$10-30 USD

Cerrado
Publicado hace casi 8 años

$10-30 USD

Pagado a la entrega
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 del proyecto: 10796706

Información sobre el proyecto

14 propuestas
Proyecto remoto
Activo hace 8 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
14 freelancers están ofertando un promedio de $37 USD por este trabajo
Avatar del usuario
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 en 4 días
4,9 (60 comentarios)
6,1
6,1
Avatar del usuario
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 en 1 día
4,9 (37 comentarios)
4,5
4,5
Avatar del usuario
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 en 1 día
5,0 (2 comentarios)
3,5
3,5
Avatar del usuario
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 en 1 día
5,0 (3 comentarios)
3,0
3,0
Avatar del usuario
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 en 0 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 0 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
i am a linux developer and often creating service using shell script
$26 USD en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de ISRAEL
Kfar saba, Israel
5,0
1
Forma de pago verificada
Miembro desde ene 8, 2012

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.