Search Results

Search: Posts Made By: mc2z674gj
2,992
Posted By elixir_sinari
Yes. perl -lne '$myvar="some...
Yes.
perl -lne '$myvar="some text";$Tget=$_;s/$/ -- $myvar/;rename "$Tget","$_";'
2,992
Posted By msabhi
You can change the text highlighted in red to...
You can change the text highlighted in red to your customized occurrence...
I hope i got your requirement right..
2,992
Posted By msabhi
For files 1>First check with the below command...
For files
1>First check with the below command if you are satisfied with the results

ls * | perl -lne '{$Tget=$_;s/\./ -- ttgductoog ggdté gollogtd./;print "$Tget"." <--TO--> "."$_";}'


2>If...
4,328
Posted By msabhi
Right elixir...new to PERL workarounds for...
Right elixir...new to PERL workarounds for files..somehow forgot its usage:wall:
Below code would be more efficient...:b:

perl -lne '{$Tget=$_;$_=~s/(.*?)(\d+)$/$2 $1/g;rename "$Tget", "$_"}' temp
4,328
Posted By msabhi
Ok. 1>First store all the necessary directory...
Ok.
1>First store all the necessary directory names into one file like "temp" and execute as usual to check if this is satisfying your conditions

perl -lne '{$Tget=$_;$_=~s/(.*?)(\d+)$/$2...
4,328
Posted By Scrutinizer
Your requirement seems to have changed. There is...
Your requirement seems to have changed. There is no separator in the second example ?
And the first example does not switch left and right side...
4,328
Posted By Scrutinizer
Try shell only: for file in *.ext do ...
Try shell only:
for file in *.ext
do
first=${file%% -- *}
secondext=${file##* -- }
second=${secondext%.*}
ext=${file##*.}
middle=${file#$first}
middle=${middle%$secondext}
mv...
4,328
Posted By msabhi
No my script doesn't work for these directories...
No my script doesn't work for these directories you have mentioned since its different conditions all together....But you can use the logic in my script as a workaround ..let me know if any help...
4,328
Posted By msabhi
1>Verify is these are the conditions you require...
1>Verify is these are the conditions you require by just printing the mv command

ls *ext | perl -F"--" -alne '{if($#F==1){
if($F[1]=~/(\d+).ext/){ $p=$1;$F[0]=~s/^/$p /g;$F[1]=~s/$p//;print "mv...
4,328
Posted By pamu
for above two case try this... for i in...
for above two case try this...

for i in *.ext
do
file_name=$(echo "$i" | awk -F " -- " '{split($NF,a,".");s=$1;$1=a[1];$(NF)=s"."a[2]}1' OFS=" -- ")
mv $i $file_name
done

for last having...
2,536
Posted By elixir_sinari
A bit convoluted but works: printf "%s\n"...
A bit convoluted but works:
printf "%s\n" *.txt|while read fname
do
if awk 'match($0,/translat(ion|ed) from/){
t=substr($0,RSTART)
gsub(/[^A-Za-z0-9_ -]/,"",t)
if(length(t)){print t;exit(0)}}...
2,536
Posted By bakunin
This will not work because "{}" can only be used...
This will not work because "{}" can only be used ONCE in an exec clause. If you want this to work you will have to write a small script, like this (stripped down to the bare minimum):

# cat...
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 06:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy