Find Jobs
Hire Freelancers

bash sed find and replace - open to bidding

$10-30 USD

Ditutup
Disiarkan hampir 8 tahun yang lalu

$10-30 USD

Dibayar semasa penghantaran
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 Projek: 10796706

Tentang projek

14 cadangan
Projek jarak jauh
Aktif 8 tahun yang lalu

Ingin menjana wang?

Faedah membida di Freelancer

Tetapkan bajet dan garis masa anda
Dapatkan bayaran untuk kerja anda
Tuliskan cadangan anda
Ianya percuma untuk mendaftar dan membida pekerjaan
14 pekerja bebas membida secara purata $37 USD untuk pekerjaan ini
Avatar Pengguna
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 dalam 4 hari
4.9 (60 ulasan)
6.1
6.1
Avatar Pengguna
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 dalam 1 hari
4.9 (37 ulasan)
4.5
4.5
Avatar Pengguna
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 dalam 1 hari
5.0 (2 ulasan)
3.5
3.5
Avatar Pengguna
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 dalam 1 hari
5.0 (3 ulasan)
3.0
3.0
Avatar Pengguna
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 dalam 0 hari
0.0 (0 ulasan)
0.0
0.0
Avatar Pengguna
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 dalam 0 hari
0.0 (0 ulasan)
0.0
0.0
Avatar Pengguna
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 dalam 1 hari
0.0 (0 ulasan)
0.0
0.0
Avatar Pengguna
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 dalam 1 hari
0.0 (0 ulasan)
0.0
0.0
Avatar Pengguna
i am a linux developer and often creating service using shell script
$26 USD dalam 1 hari
0.0 (0 ulasan)
0.0
0.0
Avatar Pengguna
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 dalam 1 hari
0.0 (0 ulasan)
0.0
0.0

Tentang klien

Bendera ISRAEL
Kfar saba, Israel
5.0
1
Kaedah pembayaran disahkan
Ahli sejak Jan 8, 2012

Pengesahan Klien

Terima kasih! Kami telah menghantar pautan melalui e-mel kepada anda untuk menuntut kredit percuma anda.
Sesuatu telah berlaku semasa menghantar e-mel anda. Sila cuba lagi.
Pengguna Berdaftar Jumlah Pekerjaan Disiarkan
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Memuatkan pratonton
Kebenaran diberikan untuk Geolocation.
Sesi log masuk anda telah luput dan telah dilog keluar. Sila log masuk sekali lagi.