bash

How to quickly infer start/end time of files that only show start time?

I have a huge list of video files from a webcam that have that look like this: video_123 video_456 video_789 ... Where each number (123, 456, and 789) represents the start time of the file in seconds since epoch. The files are created based on file size and are not always the same duration. There may also be gaps in the files (eg c...

bash script to run in 5 minutes

I just want a bash script to run 5 minutes after it's called. What am I doing wrong? I have the command: /path/to/my/script | at now + 5 min And yet the script runs right away every time. ...

Bash: redirecting output from a process that's already running?

Is there a way, in Bash, to capture/redirect the output (and stderr?) of a process once it's already running? ...

AWK/BASH: How to remove duplicate rows from file with known field range?

Hi all, I was wondering if there was a way to use bash/awk to remove duplicate rows based on a known field range. For example: Easy Going USA:22 May 1926 Easy Going Gordon USA:6 August 1925 Easy Life USA:20 May 1944 Easy Listening USA:14 January 2002 Easy Listening ...

(Node.js) application that lets me edit a local file through a web browser?

I wonder if there is a Node.js application that starts a server on the current folder to let me edit files through the web browser? Kinda like http://www.cloud9ide.com, but for general editing (scripts, text etc). ...

access arguments to bash script inside a function

Inside a function, $1 ... $n are the parameters passed to that function. Outside a function $1 ... $n are the parameters passed to the script. Can I somehow access the parameters passed to the script inside a function? ...

Bash script to find the frequency of every letter in a file

I am trying to find out the frequency of appearance of every letter in the english alphabet in an input file. How can I do this in a bash script? ...

File names with spaces in BASH

Hello, I'm trying to write script that'll crop and resize large photos into HD Wallpapers. #! /bin/bash for i in `ls *.jpg` do width=`identify -format '%w' $i` height=`identify -format '%h' $i` if [ `echo "$width/$height > 16/9" | bc -l` ] then exec `convert $i -resize 1920 -gravity Center -crop '1920x1080+0+...

question about grep pattern

I'm using grep to match string in a file, here is example file : example one, example two null, example three, example four null, grep -i null myfile.txt returns example two null, example four null, How can I return matched line + line number like this : example two null, - Line number : 2 example four null, - Line number : 4...

Simple regular expression parsing in bash

I want to parse a log file (log.txt) which contains rows similar to these: 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=26 [13676] -> "www.website.com/page.php?ID=26" [1] 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=44 [14152] -> "www.website.com/page.php?ID=44" [1] 2010-10-19 07:56:14 URL:http://www.website....

Reconnect a timed-out session

Hi everbody, When I do an ssh connection, after a while, the connection time-out and my term freeze. I know Enter + ~ + . to unfreeze it. But is there another key sequence to reconnect instead ? Thanks ...

Setting up "Clang" for Iphone Development in Xcode 3.2.4: Troubles with bash commands

Hello there, I wanted to do some Memory-Leak tracking on my App, but somehow I am not able to run Clang Static Analyzer because I always get an error message saying "command not found" when executing it with the terminal. There was no ".bash_profile" file on my mac, so I created one. Is there anything missing? Here is a picture of my...

shell script to parse log file

Hi, I am given a log file(see below), I need to make it to this format using bash script: title pdfspool date rip date bmpspool date CLAB date Sometitle12 10/09/23 00:56:40 10/9/23 0:56:46 10/9/23 0:56:50 10/9/23 1:01:13 log file !!Begin Source aserver:pdf_spool:the, Job 844b015e0043469e, Inst 844b015e0043469e T...

adb reboot doesn't complete

Hi, I'm trying to run a few test packages on my device through a shell script which runs every night and for that I need to run the adb reboot command. My problem is that the 'adb reboot' command does make the system reboot, but it never completes (I need to do a keyboard interrupt if I run it manually in order to issue another command)...

-o: command not found

I am trying to download file using curl, but I get the following error message. -o: command not found My command was curl http://lab.test.com/test/test/down.php?c=redsoul&bbs_no=236513&file_num=7061013&filename=%EC%95%84%EC%9D%B4%EC%96%B8%EB%A7%A8%2003%ED%99%94%20%28ANIMAX%201280x720%20x264%20AAC%29.SMI&size=25485 ...

Bash scripts requiring sudo password

Hi, I'm creating a Bash installer script which compiles and installs some libraries for both OSX and Linux. Because some commands in my script ("make install", "apt-get install", "port install", etc) require sudo, I need the user to supply the password. Currently the user gets asked for the password whenever the first sudo command is ...

for loop with bash from variable

Lets say I have a variable which has values : #!/bin/sh MYVARIABLE="first,second,third" for vars in MYVARIABLE do echo $vars done this above doesn't work what I want but it looks fine, this should print first second third without , I wan't it to be printed without , any sugestions? ...

bash redirect stdout and stderr to separate commands over ssh

I am using BASH 4. I am trying to find a way to legitimately prepend output to indicate the type of output that it is. I am able to do this with something kind of like this... ls -l /tmp/abcdefgh 2> >(sed 's/^/stderr: /') 1> >(sed 's/^/stdout: /') stderr: ls: cannot access /tmp/abcdefgh: No such file or directory ls -l /tmp/ 2> >(sed...

How to get a password from a shell script without echoing

I have a script that automates a process that needs access to a password protected system. The system is accessed via a command-line program that accepts the user password as an argument. I would like to prompt the user to type in his/her password, assign it to a shell variable, and then use that variable to construct the command line ...

Bash: Verifying numbers inside line closer to "big" log file

What I'm trying to do: Make a bash script that performs some tests on my system, wich than reads some log files, and in the end points me some analyzes. I have, for example, a log file (and although it's not so big sometimes, I want to save proccess when possible) that has in the end something like this: Ran 6 tests with 1 failures and...