Search Results

Search: Posts Made By: ambijat
7,261
Posted By ambijat
Thanks! that sounds swift, but can you explain me...
Thanks! that sounds swift, but can you explain me the stuff in {} because I would be able to learn by understanding. % sign...what it makes of it...please explain I am new to these.
rgs!
7,261
Posted By ambijat
#!/bin/bash a=(*.pdf) for (( i...
#!/bin/bash


a=(*.pdf)


for (( i =0; i < ${#a[i]}; i++ ))
do
echo ${a[i]} | sed 's/[[:punct:]]/_/g' | sed -e 's/_.pdf/.pdf/g'

doneKindly, see I have tried to update it.

----------...
7,261
Posted By ambijat
Thanks! RavinderSingh, but could you please...
Thanks! RavinderSingh, but could you please explain the echo part--- fairly a novice on that.
Rgs!

---------- Post updated at 11:29 AM ---------- Previous update was at 11:25 AM ----------


...
7,261
Posted By ambijat
Replacing punctuation marks with the help of sed
#!/bin/bash


a=(*.pdf)

punct=((~`!@#$%^&*()_-+=|\[]{};':",./<>?))

for (( i =0; i < ${#a[i]}; i++ ))
do
sed -ri 's/$punct//g' ${a[i]}
done

I cannot use the above code, can you help me...
22,339
Posted By ambijat
I found that this code eats all blank spaces too....
I found that this code eats all blank spaces too. I am trying meanwhile if you can solve it then its better. I found putting " " makes it solve that as follows.
sed 's/[^'$a'" "[:alnum:]]*//g'...
22,339
Posted By ambijat
thanks that is very economical. Although I have...
thanks that is very economical. Although I have to test it to my needs, but still can we introduce variable for replacing # and @ so that there is a flexibility in number and choice of punctuation to...
22,339
Posted By ambijat
Thanks! but I am a beginner so your code was...
Thanks! but I am a beginner so your code was simply hieroglyphics for me. So, I was rather scared to use it. I am only exploring some basic solutions, unless you explain every character what it means...
22,339
Posted By ambijat
more on the same
I wish to introduce array variable into sed command but in my code there is a mistake which I am not able to figure out.

#!/bin/bash
echo "Enter the type of file: "
read f

a=(*.$f)

for ((...
22,339
Posted By ambijat
what i need that there has to be a number of...
what i need that there has to be a number of iterations for each punctuation that I choose, should not be deleted. So, in that case I believe looping would be necessary. So, how can we do it.
22,339
Posted By ambijat
further improvements
I have made code more flexible in terms of choices. Can it be made better. Suggestions are most welcome.


for i in $k
do
cat ${a[$j]} | sed...
22,339
Posted By ambijat
sed and punctuations
I wish to remove punctuation except a few of my choice, for example, I wish to keep (#) and remove rest of the punctuation marks. Can this script be modified suitably please help.

#!/bin/bash
...
5,259
Posted By ambijat
Re: In continuation
cat ${a[$i]} | sed 's/\([[:space:]]\)/\1 \n/g' | sed 's/^[ \t]*//' | sed \
's/[ \t]*$//' | sed '/^$/d' | grep -v -F -f exclude.lst | tr -cd '[:alnum:] [:space:]'| sort \
| uniq -c | sort -nr | head...
5,259
Posted By ambijat
My problem is that I need specific array of words...
My problem is that I need specific array of words that should get omitted and that array you see at the bottom of the modified one. It executes for one file at a time and it should do before sorting...
5,259
Posted By ambijat
In continuation
Thanks! the square braces did the trick, now here is one more thing!
Compare the two scripts, the first one gives the results, the second one does not.

#!/bin/bash
# program for data mining
...
5,259
Posted By ambijat
some issues with file renaming with arrays
Hi! guys! again with some problem solving issue. The problem is that I have few files in a folder some are with extension .txt and some are not so how to put them all with .txt extension minus the...
5,259
Posted By ambijat
Array is needed for further using as input...
Array is needed for further using as input values.

---------- Post updated at 01:27 PM ---------- Previous update was at 01:24 PM ----------

what is the technical difference in arrays, a[@] and...
5,259
Posted By ambijat
cannot locate the mistake!
Hello friends! this is again some work on creating factorial. I am unable to locate the mistake, it gives very unique output. Kindly, have a look and sort it for me.

#!/bin/bash

fator(){
j=$((...
5,259
Posted By ambijat
Well I re-wrote the whole thing as follows and it...
Well I re-wrote the whole thing as follows and it neatly gives me the required results. I look forward to improvements from you. Thanks.

#!/bin/bash

fun()
{
j=`expr 1 + $1`
z=1
f=0
for ((...
5,259
Posted By ambijat
Well I take that as good practice but I really...
Well I take that as good practice but I really did not find program behaving any different.
My problem is with this part below.
b[$i]=$(fun $d)
I want that function to be used for creating...
5,259
Posted By ambijat
Arrays and functions
Hi Guys! I need to solve this.
I want an array to be created by a certain calculation for which I created a function. Now this array is not getting created. See script below I want array b to be the...
Showing results 1 to 20 of 20

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