scripting

from string to integer (scripts)

I have this snippet of the code: set calls = `cut -d" " -f2 ${2} | grep -c "$numbers"` set messages = `cut -d" " -f2 ${3} | grep -c "$numbers"` @ popularity = (calls * 3) + messages and error @ expression syntax what does it mean? grep -c returns number, am I wrong, thanks in advance in $numbers I have list of numbers, 2 and ...

grep options (unix)

hello everyone, can You explain please, can grep pick rows if at least one element from the list appeared, for exmaple grep "hello world" file1 grep must give me all rows which have or word hello or world or both of them, thanks in advance ...

Help needed wit the XPath statement for Selenium test

I am testing a calendar component using Selenium. In my test I want to click on the current date. Please help me with the XPath statement for doing that. I am adding the HTML for the calendar component. <input id="event_date" type="text" on="click then l:show.event.calendar" style="border: 1px solid rgb(187, 187, 187); width: 100px;" f...

Expand a window beyond Windows limitation

I try to setup UltraMon with a really big width and height for my Safari on Windows. See capture : http://cl.ly/de21e9cd2cf4f265efc4 The problem is that the width and height seems to have a max value that I would like to change. I want UltraMon not to change my width and height, even if they are bigger than the screen resolution. ...

problems with cut (unix)

hello everybody, I've got strange problem with cut I wrote script, there I have row: ... | cut -d" " -f3,4 >! out cut recieves this data (I checked it with echo) James James 033333333 0 0.00 but I recieve empty lines in out, can somebody explain why? ...

Creating a tiled map with blender

I'm looking at creating map tiles based on a 3D model made in blender, The map is 16 x 16 in blender. I've got 4 different zoom levels and each tile is 100 x 100 pixels. The entire map at the most zoomed out level is 4 x 4 tiles constructing an image of 400 x 400. The most zoomed in level is 256 x 256 obviously constructing an image ...

error in Unix (scripts)

somebody knows what does this error mean? Missing -. in google I found nothing about this ...

Shell script for testing

I want a simple testing shell script that launches a program N times in parallel, and saves each different output to a different file. I have made a start that launches the program in parallel and saves the output, but how can I keep only the outputs that are different? Also how can I actually make the echo DONE! indicate the end? #!/bi...

bitwise XOR a string in Bash

Hi. I am trying to accomplish a work in Bash scripting. I have a string which i want to XOR with my key. #!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH teststring="abcdefghijklmnopqr" Now how do i XOR the value of teststring and store it in a variable using bash? Any help will be appreciated. Basically i am trying to dup...

Windows Batch Script to Replace Environment Variables in a File

Hi. I want to write a batch file that will take the contents of a file, and replace any environment variable references inside the file with the actual environment variable values. Is this possible? Basically, if a file had this: %PROGRAM FILES%\Microsoft SQL Server\ then I would want the file contents to become: C:\Program Files\...

Ruby - Read file in batches

Hi, I am reading a file that is 10mb in size and which contains some id's. I read them into a list in ruby. I am concerned that it might cause memory issues in the future, when the number of id's in file might increase. Is there a effective way of reading a large file in batches? Thank you ...

Embedded scripting engine in a .NET application

I am looking to replace an old control being used for scripting an application. The control used to be called SAX Basic, but is now called WinWrap. It provides us with two primary functions. 1) It's a scripting engine (VB) 2) It has a GUI for developing and debugging scripts that get run in the hosting application. The first feature ...

How to line up columns using paste(1)? or how to make an aligned table merging lines in the shell?

Hi, I want to merge lines such that the merged lines are aligned on the same boundary. UNIX paste(1) does this nicely when lines all meet at the same tab boundary, but when lines differ in size (in the file that lines are being merged into), the text comes out awkward. Example of paste(1) that has the desired effect: $ echo -e "a\nb\n...

Determine stale data

Say I have a file of this format 12:04:21 .3 12:10:21 1.3 12:13:21 1.4 12:14:21 1.3 ..and so on I want to find repeated numbers in the second column for, say, 10 consequent timestamps, thereby finding staleness. 12:04:21 .3 12:10:21 1.3 12:14:21 1.3 12:10:21 1.3 12:14:21 1.3 12:12:21 1.3 12:24:21 1.3 12:30:21 1.3 12:44...

Delete lines containing a range pattern in 4rd columns

In a file 4th column contains a floating point numbers dsfsd sdfsd sdfds 4.5 dfsdfsd I want to delete the entire line if the number between -0.1 and 0.1 (or some other range). Can sed or awk do that for me? thanks ...

batch files command line arguments

hi i am setting a string in a variable set main=svn commit -m "Build version number update" install\msbuild\VersionNumber.txt and passing "%main%" as a command line argument to another script template.bat . but in template.bat "Build version number update" is cosidered a 2nd arg and rest as 3rd one. please tell me how to pass the ...

Using AWK find a smallest number in a second column bigger than x

I have a file with two columns, sdfsd 1.3 sdfds 3 sdfsdf 2.1 dsfsdf -1 if x is 2 I want to print sdfsdf 2.1 How to express it in awk (bash or sed is fine too) ...

Bash script to monitor ISDN connection

On a Ubuntu 10.04 Server I would like to do the following with a bash script: Create a service that monitors the ISDN connection and if downtime exceeds 60 seconds forces reconnect. My current solution looks something like this: #!/usr/bin/bash LOGFILE=/home/msw/router/ping-stats.txt TIME="`date +%C%y%m%d%H%M`" /sbin/ping -c 1 google.c...

What is the difference between these PHP include statements?

include("somefile.php"); include_once("somefile.php"); require("somefile.php"); require_once("somefile.php"); What is the difference between these? ...

how to run few vim commands in a raw

Hello. This is really noob question. There is set of vim commands : command1 : command2 etc., which I would neet to type in in a raw quite often. How to I make it automatic? It is simple regexp replace command set, however I cannot script those in sed, since it involves non-latin locales and for some reason vim handles non-latin r...