bash

grep commad is not working properly

I am trying to extract the value from in File.txt : 116206K->13056K(118080K), 0.0879950 secs][Tenured:274796K->68056K(274892K), 0.2713740 secs] 377579K->68056K(392972K), [Perm :17698K->17604K(17920K)], 0.3604630 secs] I have try to extract cat File.txt | grep 'Perm '| cut -d',' -f3|cut -d'(' -f2 |cut -d')' -f 1 What ...

RESTful Dictionary Service?

Hi all, this is only loosely programming related. I wrote myself a shellscript, that extracts all acronyms from a text and writes them to a file. Now I would like to process that file to add the definitions. My first google hit suggested using curl and the dict:// url scheme. However I am behind a proxy, which does not seem to allow th...

Concatenate Lines in Bash

Most command-line programs just operate on one line at a time. Can I use a common command-line utility (echo, sed, awk, etc) to concatenate every set of two lines, or would I need to write a script/program from scratch to do this? $ cat myFile line 1 line 2 line 3 line 4 $ cat myFile | __somecommand__ line 1line 2 line 3line 4 ...

Conditional actions based on error in shell script

Hi, I have a bash script that watch's a directory for uploads. When it sees a xml file in the directory. The script takes the file and calls a java command line program that using xslt transforms the file. I want to mv the file to a different directory (errors) if the script or java command line program throws a error during processing...

Bash: for each directory

I am working on a script that needs to perform an action in every sub-directory of a specific folder. What is the most efficient way to write that? ...

Securely using password as bash argument

Hi, I'm extracting a part of a web application that handles the signup, the other part will be rewritten. The idea is the signup part can exist as a separate application, interface with the rest of the application for creating and setting up the account. Obviously there are a ton of ways to do this, most of them network based solutions ...

What does it mean for the file name to be shown with red background

I'm trying to install Cisco VPN client on Linux Ubuntu 10.04. The installer creates the directory, places all the necessary files in it, and then fails to launch the binary. I tried to launch it myself, the system rebukes me too. Closer inspection yields the following: eugene@eugene-desktop:/opt/cisco/vpn/bin$ sudo chmod u+x vpnagentd ...

How to loop in bash script?

Hi, i have following lines in a bash script under Linux: ... mkdir max15 mkdir max14 mkdir max13 mkdir max12 mkdir max11 mkdir max10 ... how is the syntax for putting them in a loop, so that i don't have to write the numbers (15,14..) ? ...

bash - first argument of the previous command

Hi I know that ESC DOT gives you the last argument of the last command. But I'm interested in first argument of the last command. Is there a key binding to do so? On the same lines, is there a generic way of getting nth argument from last command. (I know that in a bash script you can use $0, $1 etc., but these don't work on commandli...

problem with awk print

Hi guys I want to print in awk line and character ' after the line, but awk put the character in the middle of the line. Here is my code : awk -v d="'" {print $0 d} i am using bash2 thanks for help ...

Weirdest segmentation fault ever.

Ok basically I'm writing a program that takes in two directories and processes them based on what options are supplied. Thing is it's giving me segmentation errors at times when I don't see a problem. The code that is causing the problem is the following: EDIT: Update the code to include my entire source file #include <unistd.h> #inclu...

Bash Script for MythTV which requires Python Dependencies

I wrote a bash script which renames MythTV files based upon data it receives. I wrote it in bash because bash has the strong points of textual data manipulation and ease of use. You can see the script itself here: http://code.google.com/p/mythicallibrarian/source/browse/trunk/mythicalLibrarian I have several users which are first time ...

Yanking text from the previous stdout onto the command line.

I'd like to set up my Bash in such a way that I could yank text from the previous command's stdout. The example use case I'll use is resolving conflicts during a git rebase. $ git status # Not currently on any branch. # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark...

Bash For-Loop on Directories

Quick Background: $ ls src file1 file2 dir1 dir2 dir3 Script: #!/bin/bash for i in src/* ; do if [ -d "$i" ]; then echo "$i" fi done Output: src/dir1 src/dir2 src/dir3 However, I want it to read: dir1 dir2 dir3 Now I realize I could sed/awk the output to remove "src/" however I am curious to know if there is a be...

How to use pastebin from shell script?

Is it possible to use pastebin (may be via their "API" functionality [http://www.pastebin.com/api.php] ) inside bash shell scripts? In detail i mean: how do i send http-post? And how do i get back the url? Thanks ahead ...

RVM not configured properly with launchd.conf

I'm using OSX Snow Leopard with /etc/launchd.conf as my primary script to add environment variables. [The contents of this file are pasted below] So far this file works fine for my shell scripts and my applications. However, adding the last 3 RVM specific lines doesn't work for me. I can't access the rvm command. I have to do $ source ...

Linux homework bash Shell

Dears, I've this assignment for my GF, n I absolutely have no clue abt Linux. Can anyone help in makin this script. . . . . . .................................... ............................................................................................................................................................ here it goes: ...

What is the simplest way of parallelization over a cluster with SSH and NFS?

I have a lot of trivially parallelizable computations and a lot (100s) of cores distributed overs SSH + NFS network. What is the simplest way of parallelization. The problem is that I don't know how long each task will take so I need some kind of queue. Is there something that is very easy to use? ...

Is there a bash equivalent to zsh's file-type globbing?

In zsh you can qualify globs with file type assertions e.g. *(/) matches only directories, *(.) only normal files, is there a way to do the same thing in bash without resorting to find? ...

Using prolog to output into bash shell

Hi. I am trying to call a prolog program and receive output into my bash script. Currently I am using the extremely crude version of using halt(0) or halt(1) and then examining the exit code in bash, using 0 as true and 1 as false to the question my prolog program answers. Is there a better way to handle output? I am using gnu prolog. I...