Programming :: Extract Part Of File Name?
Mar 26, 2010
I have this string ./DAT000728-652523058.job.I want to extract the no between DAT and - sign. I want 728. I dont want 000728.echo ./DAT000725-560162365.job | cut -d'T' -f2 | cut -d'-' -f1 I am getting 000728.string can be ./DAT326822-652523058.job also. then i need 326822
View 6 Replies
ADVERTISEMENT
Feb 12, 2010
My rquirement is I have a flat file with lot of lines on it.example:
line1
line2
line3
[code]....
View 8 Replies
View Related
Apr 19, 2011
I have a .txt-file with ~50.000 lines of numbers, generated by a mathematics program. From this file, I need line ~ 1.100 to line ~16.000 (these lines are always the same btw, this may make the solution easier, dunno) to be copy/pasted to another file, where the lines ~500 to ~15.000 (also, every time the same) should be overwritten by the aforementioned lines...I haven't found or come up with anything that works yet, mostly I find solutions to copy everything from one file to another but I can't find something to specifically overwrite a part of a file with part of another.
View 4 Replies
View Related
Jul 8, 2011
I'm trying to extract .part files. These are mac extensions similar to .rar or .zip. I need to extract a whole bunch of them simultaneously. Theyre probably registered in sequence just like .rar files. What program can I yum install or where should I look to extract these to what will probably be an ISO.
View 1 Replies
View Related
Jan 8, 2010
There are a few things I was wondering about (using tools available in bash):How to insert a file at at the specified location of another.How to copy a portion of a file between two lines matching a regex to another file (and/or making sed only work between two lines matching a regex)How would you do this?
View 2 Replies
View Related
Aug 10, 2011
I kept bumping into it all the time, only now when I need it I can't find it anywhere! What architecture is the kernel of my machine?
2.6.18-194.el5
View 1 Replies
View Related
Dec 22, 2010
I am trying to extract 2 numbers from a same file and my goal is to print them both in another file, on the same line, separated with a space. I have to do that for 20 files and I would like to have therefore 20 lines like this in the output file. It would look like this :
Quote:
number1_file1 number2_file1
number1_file2 number2_file2
...
...
number_1_file20 number2_file20
So far, I did only extract one number and got an output file like this :
Quote:
number1_file1
number1_file2
...
...
number1_file20
And I did this by running a bash script with the following content :
Code:
#!/bin/bash
ls execution$1$2*.* | while read filename
do
cat $filename | grep -e "Total aborts:" | cut -d " " -f3 >> abort$1$2.dat
done
$1 and $2 are just strings to identify the different files I want to consider in this loop. This script works well to extract a number which is the 3rd field of a line starting with "Total aborts:".Now, how could I change this script to do what I mentioned above (i.e. extracting two numbers from two different lines) ? The second number is the 3rd field of a line starting with "Total throughput:"
View 7 Replies
View Related
Mar 22, 2011
I work for a company that does remote computer support, we use VNC protocol to help our clients. I installed a VNC repeater that allows my clients to connect to me going through all firewalls and port forwarding. The linux VNC repeater outputs all connection information to /var/log/vnc.log and looks something like
Code:
UltraVnc Linux Repeater version 0.14
UltraVnc Tue Mar 22 03:37:02 2011 > routeConnections(): starting select() loop, terminate with ctrl+c
UltraVnc Tue Mar 22 03:37:12 2011 > acceptConnection(): connection accepted ok from ip: 55.555.555.55
[code].....
I need a script that reads this log file every so often (30 seconds to 5 minutes) and sends an email when an connection has been accepted. I looked into reading log files and got this so far
Code:
LOG=/var/adm/sqllog
while true
do
tail -100 $LOG | grep "ORA" > /dev/null
[code]....
View 10 Replies
View Related
Feb 14, 2011
What is the Terminology called of a Binary using a file that is not part of it's self? An example would be when a browser uses a HTML file for it's interface. The binaries code has to know how to find it and so on. I imagine that the applications binary uses a system call and that another application takes over.
View 1 Replies
View Related
Aug 3, 2010
I am trying to write commands that extracts the height and width of a video file via ffmpeg. I have the following working so far:
This gives the following answer in widthxheight format with an extra , 720x480,
How can I instead run 2 separate commands that give me height and width separately? I want some command to give me 720 and another command to give me 480 and I dont need the x or the ,
If you need to know this is what ffmpeg -i videofile.mov 2>&1 gives as output
Seems stream 0 codec frame rate differs from container frame rate:
At least one output file must be specified
View 6 Replies
View Related
Mar 10, 2011
I'm trying to extract specific lines from a flat file. I need lines that fall within a range of coordinates. The -F can be either ! or = If the line is in this set range I need all of the data on that line. ranges lat 36 to 39 and longitude -74 to -84
awk -F '=' '{lat=substr($2,1,2); lon=substr($2,10,3); (lat >36 && lat <39) && (lon >-74 && lon <-84); print lat"--"lon}' < net.log
example line from the flat file
K4MQF-3>APN383,VA2-2,qAR,N3HF-5:!3818.65NS07800.17W#PHG77306/W3,VA3/Clarke Mnt
View 9 Replies
View Related
Mar 6, 2009
I have two files containing list of packages using
Code:
dpkg --get-selections > file-name
command.
package-a.txt
[code]......
Now I would like to create a third file which contains only those packages which are present in package-a.txt but NOT in package-b.txt. The file should look like this:
Code:
package2
package4
Note: The world "install" is also to be removed for all packages. Using diff command I could get something like this:
Code:
temp# diff -yb package-a.txt package-b.txt | grep "<"
package2 install <
package4 install <
<
temp#
But not sure how to remove instances of "install" and "<".
View 3 Replies
View Related
Jun 24, 2010
I need to install fedora on my new 16 DELL servers. I will doing it through DRAC (Dell remote access console) but DRAC can mount only one ISO at a time. I am planning to do multiple installations at the same time.hence i need multiple boot.iso files for each and every DRAC console that I open for each server.The question is...How to extract just the bootable part from the fedora DVD? I don't whether it should be called boot.iso, but I hope you get my point.I believe it has got something to do with the "isolinux" folder on the DVD, but I don't know what and how.
View 4 Replies
View Related
Feb 13, 2011
I'm using Ubuntu for about a half year. Currently version 10.10. The next problem I have with Nautilus: He have it in ListView. If I want to rename a file then the entire file is selected and not only the first part. So the file extension is also selected. I think this is a bug, whoich can be found on the Internet, but I do not find a solution. Does anyone here have a solution?
View 4 Replies
View Related
Sep 1, 2011
When ever I extract a file from a .tar or whatever, it isn't detected. I notice this mainly when i'm using xampp. I copy zip up all my files on one computer, load ubuntu on another, extract the files to the web folder (htdocs) and then I get nothing. However, when I manually create the files directly on my computer as opposed to extracting them, they appear.
Is there something I need to do in order to have these files appear? Is there some sort of file system refresh? Or am I being a complete idiot?
View 5 Replies
View Related
Dec 1, 2010
website.com/john/doe/index.htmlI need to cut that to say:website.com/john/doe/I am getting really close using sed, but I just can't get the syntax quite right.
View 2 Replies
View Related
Dec 8, 2010
I just used dd to clone a linux partition to a new hard drive, it had 800mb left on the old hard drive, after dd, new hard drive lists 1.29/1.3 terabytes full. Is this what happens by default in dd? How can I fix this?
View 1 Replies
View Related
Oct 24, 2010
is it possible in C to use a counter as part of a variable name?
View 2 Replies
View Related
Jul 8, 2011
I am trying to transpose the following row:
x1 x2 x3 x4
into
x1 X2
x3 x4
With tr '''' < file I can select all columns to become separate rows,but as you see x3 and x4 have to be grouped when transposing.Or should I use awk for this one?
View 1 Replies
View Related
May 24, 2010
I'm trying to figure out how to access the local part and the domain part of an email address in postfix's main.cf. For example, myname@mydomain.net has myname as the local part and mydomain.net as the domain part.I get the whole email address with %s. I want to speed up the lookups by writing better database queries.I've had no luck finding this in the otherwise well documented postfix.
View 2 Replies
View Related
Dec 27, 2008
I need to extract a price from a string, this may vary in the future so it may be 12.99 or 14.99. i thought a sed command might crack it and i need to write to a file:<td><b class="priceLarge">?6.99</b>I need to extract the price 6.99(with no ?)so extract anyhting between "> and </B> and write it to a file such as tmp1.txt .
View 1 Replies
View Related
Jul 13, 2009
we have access to one domain name , 1 internet ip address and may servers hosting different part of site. I want them all to be accessed via same web site . some of the server in our network are embedded devices.they have their specific utility being hosted on that machine. So the severs are bound to be distributed . I just wanted to know how can I access them via single ip, domain name.
View 6 Replies
View Related
Sep 27, 2010
I have a macro which I use with ROOT. In this macro I want to check if a part of string exist so I can ignore it inside a loop. So, inside a loop I want to have something like:
Code:
if (string == "pre_ti_data_bdt*" || string == "pre_ti_data_nn*")
continue;
but of course I cannot use * in this piece of code! How to do this trick in C++?
View 5 Replies
View Related
Jan 14, 2010
In bootseqence of linux, the first step is check the CMOSRAM(size 64bytes) setup for custmor setting. So i am just confused wether CMOSRAM is a part of motherboard or is a part of RAM itself.
View 4 Replies
View Related
Aug 25, 2010
I am trying to extract a web page via Google for processing. I am able to create a proper query and test it using cut/paste into the address bar of my firefox browser.
When I attempt to extract the page with wget:
wget -O - -q "$query"
I do not see the information that is present when I used the browser.
View 2 Replies
View Related
Jul 18, 2011
I have a lot of files containing chat-log (IRC) and would like to extract information out of these files.
File sample
Code:
Session Start: Sat Apr 03 15:06:29 2010
Session Ident: XXX
[15:06] XXX is ~X@host-85-85-85-154.isp.be * XXX
[15:06] XXX on #channel1 #channel2 #channel3
[Code]....
View 2 Replies
View Related
Aug 28, 2010
I have many files in a folder from which I need to extract some contents, these are basically text files wich have individual lines with (i.e)
name: john
address: whatever
phone: 123456
Some caveats
1. Sometimes a line might be missing.
name: johnn
phone: 123456
2. Lines are not in the same line-numbers across the files I did try some things with awk based on google searches but I couldn't extract the data of each file into a single line (this is the ultimate goal):
john,whatever,123456
I don't have knowledge other than having put some bash scripts together for backup jobs, so I am open to install anything that could to pull this off.
View 14 Replies
View Related
Nov 27, 2010
I'm trying to create an application that monitors, among other things, what site the user is currently viewing. I would like to know if there is any way to get the current URL from the Firefox's address bar on a Linux machine. I know that under Windows I can use the DDE server approach, but under Linux this task is proving very tricky. I've considered an approach involving an extension to Firefox, but this would require the user to install the said extension himself. Which is not something I want. If an extension can be installed by a different program's installer than that could work, but I don't know if that's possible or not.
View 14 Replies
View Related
Jul 2, 2009
The idea is to make a website to check the availability of domains and it works but its not pretty yet. Below is what i have till so far:
## this is the API from my domain registrar.
<?php $client = new SoapClient('http://api.sync.com/?wsdl');
## I have a search box that sends the request to this page
$var = $_GET ["s"];
## remove the most common subdomains from the request.
$var=eregi_replace("www.", "", $var);
$var=eregi_replace("mail.", "", $var);
$var=eregi_replace("ftp.", "", $var);
$var=eregi_replace("pop.", "", $var);
$var=eregi_replace("smtp.", "", $var);
## remove any TLD extension from the request.
$split = explode(".", $var);
$main = $split[0];
$arraysize = sizeof($split);
for ($x=1; $x<$arraysize; $x++) {
$tld .= "." . $split[$x];
}
## login to the API
$paramLogin = array('handle' => 'randall', 'password' => 'password');
## match the domain with any possible TLD
$varcom = $paramAvailDomain = array('sld' => $main, 'tld' => 'com');
$varnet = $paramAvailDomain = array('sld' => $main, 'tld' => 'net');
$varorg = $paramAvailDomain = array('sld' => $main, 'tld' => 'org');
$varbiz = $paramAvailDomain = array('sld' => $main, 'tld' => 'biz');
$varinfo = $paramAvailDomain = array('sld' => $main, 'tld' => 'info');
$vareu = $paramAvailDomain = array('sld' => $main, 'tld' => 'eu');
$varnl = $paramAvailDomain = array('sld' => $main, 'tld' => 'nl');
$varbe = $paramAvailDomain = array('sld' => $main, 'tld' => 'be');
$varde = $paramAvailDomain = array('sld' => $main, 'tld' => 'de');
$varcouk = $paramAvailDomain = array('sld' => $main, 'tld' => 'co.uk');
$varorguk = $paramAvailDomain = array('sld' => $main, 'tld' => 'org.uk');
$varname = $paramAvailDomain = array('sld' => $main, 'tld' => 'name');
$varmobi = $paramAvailDomain = array('sld' => $main, 'tld' => 'mobi');
$varin = $paramAvailDomain = array('sld' => $main, 'tld' => 'in');
$vartv = $paramAvailDomain = array('sld' => $main, 'tld' => 'tv');
$varcn = $paramAvailDomain = array('sld' => $main, 'tld' => 'cn');
$varws = $paramAvailDomain = array('sld' => $main, 'tld' => 'ws');
$varnu = $paramAvailDomain = array('sld' => $main, 'tld' => 'nu');
$varbz = $paramAvailDomain = array('sld' => $main, 'tld' => 'bz');
$varcc = $paramAvailDomain = array('sld' => $main, 'tld' => 'cc');
## this requests the domain.COM and domain.NET
$varcom;
$varnet;
?>
<div id="content">
## below prints the result
<?php
print "<html><body><pre>";
$result1 = $client->__soapCall('Login', $paramLogin);
echo "<b>Result Login:</b>
" . print_r($result1, true);
$result15 = $client->__soapCall('AvailabilityDomain', $varcom);
$resvarcom = var_dump($result15, true);
$result15 = $client->__soapCall('AvailabilityDomain', $varnet);
$resvarnet = var_dump($result15, true);
print "</pre></html>";
?>
<?php
## the returned array looks like this
Result Login:
Array
(
[code] => 200
[message] => Login succesful
)
array(3) {
["code"]=>
string(3) "200"
["message"]=>
string(20) "Domain not available"
["result"]=>
object(stdClass)#236 (1) {
["status"]=>
string(5) "TAKEN"
}
}
bool(true)
array(3) {
["code"]=>
string(3) "200"
["message"]=>
string(16) "Domain available"
["result"]=>
object(stdClass)#232 (1) {
["status"]=>
string(4) "FREE"
}
}
bool(true)
?>
## till so far it works
What I need to do is to make this ugly looking reply in to something more readable, basically if TAKEN print occupied and if free print its yours to grab. I have been struggling with the in_array function but i'm not getting anywhere close in getting it to work.
View 2 Replies
View Related
Mar 13, 2009
I am trying to get the metadata out from an image file in python. I have tried using PIL but it does not give me the data I am looking for (mostly just got a bunch of hex code) and I have no idea how to use ImageMagick, the python module is poorly documented and I can't find any examples on the net.The info I need is stuff like camera model, if flash was used, focal length, exposure time, date, etc.. pretty much the same info I get when I look at the "Image" tab on properties in Nautilus on Ubuntu.
What I am doing is writing a script that will iterate through a lot of pictures and put all this metadata into MySQL. I chose python since it is simple and I am familiar with it. But I can't find a good way to get that metadata from within python.
View 2 Replies
View Related