Programming :: Parse Text For Host List?
Feb 22, 2011
To run a parallel chemistry program, I need to build the host list. The cluster already has SGE(grid engine) installed and it generates a host list file with the following contents:
compute-1-1.local 2 all.q@compute-1-1.local UNDEFINED
compute-2-1.local 2 all.q@compute-1-1.local UNDEFINED
The important bits are hostname(ex compute-1-1) and number of cpus to use(ex 2). And for this program, it wants them in this form, a shell variable: HOSTLIST=hostname:cpus=X hostname:cpus=X .... I've tried this script, but it doesn't work
Code:
#!/bin/bash
spacer=":cpus="
let count=0
[code]....
View 5 Replies
ADVERTISEMENT
Jul 13, 2010
I am trying to think of a logic where my file contains some data I had to read and do some processing. Issue is that file contains data multiple times. For example:
:::::::::::
var1=value1
var2=value2
[code].....
I have to read first paragraph of variables and do some processing and then move on until the end of file. Variable names are same in whole file but for each paragraph the value is different. I can't think of a logic to attain this task. How can I do it? It should be a simple bash script, but I am not able to work out.
View 2 Replies
View Related
Jun 25, 2010
I get this error message: E: Malformed line 57 in source list /etc/apt/sources.list (dist parse)
I am pretty new to Ubuntu and dont really understand computer
Here is the sources list (??) as well
View 3 Replies
View Related
Sep 30, 2010
I'm having a bit of a trouble getting a particular field replaced in a host list. I have a MasterHostList which has a comma delimiter for fields and a new line to separate servers.
server1,random,random,group1,random,random
server2,random,random,group1,random,random
I then have a file.list file with a grouping of server names. What I need is to search the MasterHostList and for each server that is in the file.list I need to change the fourth field from group1 to group2 without changing the order or position of anything in the MasterHostList. Obviously the above names are arbitrary.
Failed attempts have been: for SERVER in `cat file.list`; do sed /$SERVER/s/,group1,/,group2,/ MasterHostList MasterHostList.tmp && mv -f MasterHostList.tmp MasterHostList; done for SERVER in `cat file.list`;do awk 'BEGIN { FS=OFS="," } /^${SERVER}/ { $4 = "group2" } 1' ./MasterHostList MasterHostList.tmp && mv -f MasterHostList.tmp MasterHostList; done
Both of these would in various output tests find the correct lines, but it wouldn't change them all correctly.
View 3 Replies
View Related
Dec 21, 2010
I have a file with 5000 lines. it is a list of books authors, series and titles. all lines start with the author names, than there is a dash (-) than the series name, a dash again and the title of the book.
The problem I encounter is that sometime there is a series, sometime not, and as I try to enter this list in a database, I wanted to create a cvs file to import into mysql.
ex:
The best would be to be able to add in the second line, a "space dash space" just after the author name, but how to make sure it does not do it to the first line as well.
If I could separate all line with 2 dash, (grep ?) then I would be able to do a simple replace, and change the single dash into two.
View 2 Replies
View Related
Feb 6, 2011
I'm wondering how it is possible to read each line from a text file, and then store each line separately in a list, using C++?
View 2 Replies
View Related
Apr 6, 2010
I'm not sure if this is best done in Perl or Bash. I'm thinking surely someone else has created something close to what I'm looking for. The results of the script would be that someone would kick off "linux_hosts.sh" r whatever you want to call it, then a top "folder" of options (with hosts contained within each of these top menu choices), then, based on which number corresponds to that top level, they're presented with a set of linux hosts that are relevant to that top level name. Example:
$ linux_hosts.sh
1. VMware hosts 4. Private Domain
2. ESX servers 5. Red Hat boxes
[code]...
View 4 Replies
View Related
Jul 22, 2010
AKA "zipping on the fly .. the slow-as-molasses way." The list includes full pathnames to each file, and they're all in subfolders of the same parent folder (which, unfortunately, is not the root folder of the drive or system on which the files reside). A cleaned-up and radio-ready portion of the list looks like
Quote:
.../taiga/ahqr-va-choyvp/bv0884-073.jpg
.../taiga/ahqr-va-choyvp/bv2635-073.jpg
.../taiga/ahqr-va-choyvp/bv3067-175.jpg
[code]....
What I'd like to be able to do is zip all the files in the list into a single archive, to avoid the step of having to copy them to the same location (presumably another folder on the HD) and then zip that folder. I'm more inclined to make provisions about extracting to a single folder at some other time. Is this possible in BASH, or would I have to consider a faster, more robust scripting language such as python or perl?
View 8 Replies
View Related
Oct 12, 2010
I got a bunch of machines (~10) that I share with my co-workers. I have appropriate .ssh file(s) set up so I don't get prompt for password when I try to ssh.Currently I ssh into these hosts and then do a top to check the load before I start using the machine. Because I don't want to be on a busy host.Can someone show me how to write a script that find a least-busy host given a list of hosts to check? (hardcoded is fine)
View 1 Replies
View Related
Apr 29, 2011
Go to a specified directory and open a log file and parse out specific information and dump it into another text file.
View 4 Replies
View Related
Apr 27, 2011
I want to write a bash script to parse a text file with the following lines and set variables for each line so that I can use them in the rest of the script.
Timestamp=123456789
Company=ABC Company
Server=Server
Recipient=Joe Smith
Email=joe@abc.com
simplest way to read each line one at a time for everything before the =, set that to a variable name with the value equal to everything after the =
View 14 Replies
View Related
Feb 10, 2011
I'm running and XP virtual machine using KVM / QEMU. THere are time when I need to copy text from an application in the Fedora host machine and paste the text into a different app in the XP guest machine. I was able to do this using Vitualbox on an earlier version of Fedora.
View 1 Replies
View Related
Mar 24, 2010
what is the best command to use to parse strings?I have a variable $str and need to parse this string.Can you provide an example of the command used to get a substring of $str based on the index values of start and end
View 3 Replies
View Related
Feb 4, 2010
How to let awk consider a string by double quota as one field? for example:
echo "first "second is a string"" | awk '{ print $2 }'
I want to print out "second is a string".
View 8 Replies
View Related
Jan 20, 2011
I am novice. I am trying to create one email form. But i am getting "Parse error: parse error in F:estwampwwwsendmail.php on line 43"
Code:
<?php
if(isset($_POST['email'])) {
[code]....
View 3 Replies
View Related
Jul 28, 2010
I got this xml
...
<other stuff="etc">...</other>
<cluster id="1">
<host ipaddress="192.168.50.1" name="server1">
<host ipaddress="192.168.50.2" name="server2">
<host ipaddress="192.168.50.3" name="server3">
</cluster>
...
how would i get the ip addresses only using bash.
View 4 Replies
View Related
Apr 17, 2011
My php knowledge is very poor (only worked with strings so far), and I am faced which a task that is a real challenge for me: I have a variable, that contains data of different type, in this order: byte, byte, string, string, string, string, short, byte, byte, byte, byte, byte, byte, byte, string.
Strings are of variable length. How could this data be parsed into variables of the right type, and then all converted to strings? What are the functions to use? Strings are unicode ones, and they are delimited by "
View 4 Replies
View Related
Nov 17, 2010
I have to parse a file containing billions of records and populate them in the Data structure. I have used a lot of C++ class and creating objects of the class I am storing the information retrieved by parsing the file.
Now as the file become huge and number of objects become very large my code is getting bad_alloc error as it is not finding any space avalable in the heap for allocating new object.
Is there any way to parse the file?
View 7 Replies
View Related
Nov 27, 2010
I'm currently curios with my python program which the basic goal is to parse the character in mytestfile;let's see the code
Code:
f=open('/home/andrewraharjo/Desktop/snort.log','r')
j=f.read()
[code]...
View 3 Replies
View Related
Apr 19, 2010
I have a basic HTML file set up which allows my to input some data. I have a MySql database set up behind the scenes with a table for this information to go in. When I click the submit button in my HTML file this PHP file opens and it comes up with "Parse error: parse error in C:wampwwwcomp39xinsert_student.php on line 32"Here is my code I am using in the PHP file:-
<html>
<head>
<title>COMP 39x FInal Year Project - Student Added?</title>
[code]....
View 2 Replies
View Related
Jul 26, 2010
I need to read a file and parse a string. I know in Perl there is the split command. Is there something similar to that in C++?
View 6 Replies
View Related
Nov 4, 2010
I don't think this is a "perl one-liner" of find and replace. I'm trying to auto-fill some information in a listing of files. The simplest example is that in the files the following exists:
I would want the script to find this and populate it with something like -- Date : 20101004-1758
I have a few more similar fields to autofill, and I'd like to do this from within a larger perl script I'm developing to process these files. So, how I perform in-place file modification from within a perl script?
View 3 Replies
View Related
Feb 6, 2011
I'm trying to figure out how I can get a request count per CIDR/24 from an apache log in combined format - e.g.:
Code:
24.147.44.122 - frank [10/Oct/2011:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "[URL] "Mozilla/4.08 [en] (Win98; I ;Nav)"
I'm stuck using BASH for this and I generally write everything in Python, or even Perl if necessary so BASH isn't the most comfortable for me. I've got enough to extract the IPs and get a count I just need a slick way to come up with a sum on a per CIDR basis.
View 3 Replies
View Related
Jul 5, 2010
what's the difference between the following 2 methods for specifying in httpd.conf to use PHP to parse files with extension .php?
Method 1
AddType application/x-httpd-php .php
Method 2
LoadModule php5_module modules/libphp5.so
<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>
View 2 Replies
View Related
Apr 14, 2011
There is a file with that format of each models' information.I don't think that's good format, but I cannot change that format. I needed to modify the model name, 'model = xxx' as 'model = abc'.And I don't know how to parse and modify 'model = iii' and 'model = ddd'.The only clue to parse 'model = ddd' is the second 'model = ' after the second 'system information'. But how to parse the second keyword?Is it possible with 'sed'?I sometimes have to modify the information of the file.using shell script if possible.Python is ok. (Shell script is better for me.)
View 15 Replies
View Related
Aug 6, 2010
I would like to extract Room number, Lastname,Firstname,invoice (205880080),arrival date, departure date, and total(229.46). Can you at least give me a hint on how to proceed? I have tried a lot but I am stumped from the beginning.
***History***
Room: 124 B Payment: Bell/TRAVELSCAPE.COM
Lastname*FIT*,Firstname 4A, 0K, 0B Guest
Bell *205880080 FT
Bell *205880080 July 31, 2010
[Code]...
View 4 Replies
View Related
Jan 27, 2011
I'm creating a comment form for a website but when I try to connect the page with a database it gives me a parse error. here are the codes I wrote:
[Code]....
View 1 Replies
View Related
Jun 2, 2011
I have a collection of redirect links I need to grab the final domain from (indicated after "->"):
[url]
[url]
I'm thinking PHP/cURL is the way to do it. I've searched the net but failed to find a solution that works for all redirection links.
View 2 Replies
View Related
May 13, 2009
I'm trying to write a script that will spider a particular webpage that shows the current inventory for their products. I need to figure out the optimal method of parsing the web page, and extracting the <td> line for the "qty" for "Product 2":
Code:
<table border="0" width="100%" cellspacing="1" cellpadding="3">
<tr>
<td align="left" style="background-color: #EAEAFF; border-bottom-style: solid; border-bottom-width: 1" nowrap width="20%" height="50">
<p align="left"><font face="Arial" size="2"><b> Evaluation
[code[.....
View 4 Replies
View Related
Aug 21, 2010
I am trying to make a perl script which reads data from a file and parse it. The data in the file has the following syntax
Code:
Device Physical Name : Not Visible
Device Symmetrix Name : 1234
Device Serial ID : N/A
Attached BCV Device : N/A
Device Capacity
[Code]...
Each unique record starts with "Device Physical Name". So, I have a set of records within "Device Physical Name". I want to read this set of records starting from "Device Physical Name" and ends up till next "Device Physical Name". Offcourse FS is ":", and I just want to print/or later put info in a csv file.
View 14 Replies
View Related