General :: CLI Commands To Generate Random Result From Specified List?
Jul 20, 2011
List of 77 lines with the names of movies. For ease, let's say it's in a text file. What I want is a command line argument I can pass that'll read each line and pick one of those 77 lines at random, except I can't figure out how to do this. Is there a program I can just pipe the output of 'cat listofmovies.txt' to?
I want to generate a temporary random list from a directory of files and then determine the size of an arbitrary block of files from this list (say 1-25 or 26-50) and add their names to a file along with some other info for each name. I can generate a random list with file sizes like this: ls -l | sort -R | cut -d " " -f 6 but i'm not sure how to add up the sizes of just a certain block of these files and at the same time save the file names.
Not only that but I need tons and tons of them generated, and I need it to be totally random each time.
Code: matthew@mvm:/h/misc> cat a #!/bin/bash for i in {1..5}; do echo $RANDOM
[Code]....
There you can see that it is the same number. It does that every time!! Grrr. The strange thing is each time I manually type [or copy & paste] it into the terminal, it gives random [not static, like I am getting from my script] results.
The reason I want this is because I am making a script where this line will randomly go up or down [depending on if the random number is 1 or 0].
I need to generate random numbers using /dev/random in C. The numbers should be of type double (64-bit floating point).The functionality should be equal to linux command "od -An -N8 -t fD /dev/random", but written in C.The prototype should be "double drand(void);".
A script to generate random dates. It uses the year range 2006-2009, and truncates every month of the year to an ordinary February's 28 days, but otherwise it's pretty solid and safe.
My application requires that I run dos commands on a Windows desktop which is in the same network as the Suse server. The command needs to be initiated from my Suse serverand I need to get the result of the command from Windows on my Suse server
i have a java program and to run it, i have to go into terminal and typecd <where the file is>java -jar <filename>.jarthis works fine, but is there a way to make a shortcut/small program to do this for me when i double click?
I get ubuntu 10.04 LTS installed on my PC and laptop , and I tried ubuntu one.It worked and I want to have a test, so I removed the two devices that already subscribed to my ubuntu one account, after that, I found I can't get them subscribed back.Everytime I start ubuntu one preference , I'll get the error message: got empty result for devices list.How can I add my two devices back to my ubuntu one account (I googled a lot and found that someone pointed that delete the ubuntu one's key will work, so if this is the right solution, how to delete it?
if I open a terminal and hit [TAB] [TAB] it will display "Display all 2583 possibilities? (y or n) ". If I press y is there a way to capture the output and write it to a file? Not like it is a command so I can't just use a redirect to a file? If not I guess I could just do an ls on all locations of $PATH and capture that to a file.
I've just started experimenting with SSH tunnels. I wanted a way to connect to MySQL on our website VPS but wanted the connection encrypted rather than just using PHP's mysql_connect() function and connecting to the remote IP. This seems to be working great. I'm also looking into autossh to make sure that the tunnel gets reconnected when it drops.is there a command/utility that can list the currently active SSH tunnels? Be great if there was a way of terminating an active tunnel through a command as well. Or is it a case of manually digging through the process list and killing the specific PID like I have been?
I'm trying to generate a list of my music directory folder structure WITHOUT the files included. I have my music directory set up in a hierarchy of Artist>Album>Files, and I just want to generate a list of the folders because that will, in effect, output a list of what albums I have by what artists, which is ultimately what I'm after. I did some looking on the internet through various forums over the past few days and found two ideas that looked promising, but ended up being not exactly what I needed. The first was to generate a .txt file based off of a shell ls command:
ls -R [music directory name] >> ~/mymusiclist.txt
That's great, except that it also includes the 40,000+ individual music files by name. I'm not about to invest that much time editing the files out of the list when I know there has to be an easier way.The second idea I came upon involved using the extglob function. I tried enabling extglob and using it to input a "negative wildcard" into the above method to remove anything .mp3 from the returned list, but extglob didn't play well in that context. I'm not a command line wizard, so it's entirely possible that I'm missing something fairly obvious. In fact, I'm sure I am. So this is a great opportunity for me to learn something new. If anybody knows of a command line way to do this, I'd love to know it. Or, even better, if anybody knows of an app that can do this, even better. I'm not above installing a secondary music player just to import the library once and get my list.
if there is an application available to generate a list with files and folders from a location, like a hard drive or a folder? The list could be in any format, even a text file would be just fine.
i am working on some kind of PBX and i have list of telephone numbers inside a file, i have to insert these numbers into the correct command and then telnet to a remote server and execute these commands. i can read the telephone numbers and insert them into the command with no problem, but when i try to insert these commands into the send i face problem. here is the basic code
i can make external loop inside the Bash which read the input file and issue the command and then telnet and execute, but this will make the script connects and disconnects again for each line which cause high load on that server and hardwar problem. i am wondering if there is an option inside the expect interperter which makes the send read directly from a file... somthing like this:
My problem is that I am unable to do a routine upgrade of packages. When I try to perform an upgrade, the following occurs:
Code:
$ sudo aptitude dist-upgrade Reading package lists... Done Building dependency tree
[code]....
If I try to install another package, I get the following message:
Code:
E: I wasn't able to locate file for the tzdata-java package. This might mean you need to manually fix this package. E: I wasn't able to locate file for the tzdata-java package. This might mean you need to manually fix this package. E: Internal error: couldn't generate list of packages to download
I was wondering if there is an application that allows the computer to chose a screensaver at random from a specific list that you make. I know that you can make the computer choose any screensaver at random, but I want it to choose only the ones I specify at random. I have about 6 screensavers that I want it to choose at random.
Is there a Linux program I can use to display random words from a list? By entering words in a spreadsheet and then sorting the list in alphabetical order, I made a list of new vocabulary words for myself to memorize, and wondered whether I could make random words from the list display on the screen daily. I know I could write a program to do that if I knew programming, but I don't.
I want to see the users list and the permissions of the users when i logged in a root and how to change the permissions of the users. 2.How to change the permissions for the commands. example:when i logged with my other user account(not with root user) i dont have a permission to use the move(mv) command. #mv filename /backup my error : Permission denied. I need to know how we can set the permissions for the commands even.
For example, when I want to have an identical line to the above line, I must press "yy" and then P (or p). Could somebody give me the list of such commands.
I for the life of me can not find the list of CLI/console commands for Deluge. I'm trying to at least find the command to change global download speed.
I have an Ubuntu Linux on a VMWare running and I've installed RPM Package Manager. However when I try to query all packages using the rpm -qa command, I don't get any results returned.
#!/bin/shLOOK_FOR="NTLMAuthenticationFilter"for i in `find ./ -name "*jar"`doecho "Looking in $i ..."grepjar -e $LOOK_FOR $idoneI wrote the script above, and try to find if there any file name LOOK_FOR exist in those jar,my quest is: grepjar -e $LOOK_FOR $ihere how can I check if there are any successful result , and output them ?
I'm looking for a script that copies a random .jpg from a random folder in my ~/Pictures folder to my ~/temp folder with a standard filename. This file will then be displayed in Conky. I can fix the last part, but I cannot find a way to do the first part.