Search Results

Search: Posts Made By: scorpioraghu
24,409
Posted By scorpioraghu
Thanks Lem, that helps. Leading zeroes are...
Thanks Lem, that helps. Leading zeroes are acceptable.
24,409
Posted By scorpioraghu
Generate 16 digit positive random Numbers
Hi Unix Gurus,

I have a requirement to generate positive random 16 and 13 digit numbers.

Here is the script I have so far.....



number=$RANDOM$RANDOM$RANDOM$RANDOM;
let "number %=...
952
Posted By scorpioraghu
Rename file with certain conditions
Hi,

Trying to rename a file nexus-1234 to nexus-$randomnumber.

This is what I have so far...




number=$RANDOM$RANDOM$RANDOM$RANDOM;
let "number %= 10000000000000000";
LOGFILE=test.log...
1,977
Posted By scorpioraghu
Hi Jim, It's giving an error saying... ...
Hi Jim,

It's giving an error saying...


Command '"./changeBatchID.sh"'
failed with return code 0 and error message
./changeBatchID.sh: line 15: nexus-/27041: No such file or directory
mv:...
1,977
Posted By scorpioraghu
Remove all digits and rename a file
Hi,

I have a file nexus-1234 in a directory. I want to generate a random number and replace the 1234 with it and rename the file.

So nexus-1234 becomes nexus-2863 after running the script.
...
37,021
Posted By scorpioraghu
Can you please explain what is wrong? Appreciate...
Can you please explain what is wrong? Appreciate your help.

---------- Post updated at 11:33 AM ---------- Previous update was at 10:52 AM ----------

Thanks !! that worked....
37,021
Posted By scorpioraghu
Hi Prince of Persia, That eliminated the...
Hi Prince of Persia,

That eliminated the syntax errors, but it's not matching the file name....
I have in the directory a file name like nexus-55511533

It's not able to match the...
37,021
Posted By scorpioraghu
Hi Scott, It's failing with the following...
Hi Scott,

It's failing with the following error. BTW, it's bash shell.

Command '"./test.sh"'
failed with return code 2 and error message
./test.sh: line 11: syntax error in conditional...
37,021
Posted By scorpioraghu
How to check if a filename in a directory starts with a certain string
Hello,

Trying to iterate over set of file in current directory and check if the file name in that folder matches certain string. This is what I have so far. Here I am checking if the file name...
3,756
Posted By scorpioraghu
Yeah I realized that now. This seems to be taking...
Yeah I realized that now. This seems to be taking care of it.
sed 's/[0-9]\{1,\}/999/1' $file > $$
mv $$ $file

The script you gave me
printf '%s\n' ',s/^[^,]*/999/' w q | ed -s $file
is...
3,756
Posted By scorpioraghu
Got it with this.. awk -F",@," '{sub($1,999);...
Got it with this..
awk -F",@," '{sub($1,999); print}' $file >> $file

Thanks guys, you rock !!!, I am amazed by the quick replies unlike the java forums I usually visit...
3,756
Posted By scorpioraghu
Can you guys tell me how do I make the changes go...
Can you guys tell me how do I make the changes go into the files?
3,756
Posted By scorpioraghu
alister, actually the first field in all the...
alister, actually the first field in all the files is always a number.
3,756
Posted By scorpioraghu
Hi Shamrock, Thanks for the help. The script...
Hi Shamrock,

Thanks for the help. The script is working but is not able to change the contents in the file.
I am not sure if it has to do with any permissions, but when I ran the script and...
3,756
Posted By scorpioraghu
Replace first number of each line in a file with another number
Hi,


I have a set of files in a directory that I have to read and replace the first occurrence of a number with another dummy number. This is what I have so far but it does not seem to work. The...
Showing results 1 to 15 of 15

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