General :: Parsing File With Multiple Delimiters?
Jun 21, 2011
I am using nessus to scan systems, and it generates the report file without any specific delimiter. Shown below is how a typical line in the file reads (It might show up as a very long line.
Code:
xx.xx.xx.xx|cpq-wbem (2301/tcp)|49272|REPORT|Synopsis :;;The remote web server is affected by multiple vulnerabilities.;;Description :;;According to its self-reported version number, the HP System;Management Homepage install on the remote host is earlier than 6.2. ;Such versions are reportedly affected by the following ;vulnerabilities :;; - Session renegotiations are not handled properly, which; could be exploited to insert
[code]....
The field of interest (for me) are IP ADDRESS, Synopsys, Description, Solution and Risk Factor. I tried the following command to parse this:
Code:
sed s/:;;/|/g report.nsr | grep Risk Factor |High | awk 'BEGIN {FS = "[:][;][;]"} {printf("%s|%s|%s|%s",$1, $6, $7, $10)}'
But this would not give desired results as ':;;' is not a standard delimiter and hence gives incorrect results. how to grab everything that occurs between the strings 'Synopsys', 'Description', 'Solution' & 'Risk factor' in the above example? In other words i may be asking to use multiple delimiters.. in the order of occurance.. is there a tool that supports multiple delimiters?
View 7 Replies
ADVERTISEMENT
Jun 13, 2011
I am trying to import a data file from old DOS application into MYSQL table The file is clear text file with fixed-width columns, without column delimiters
Example file :
Code:
4444333666666
2222666555555
iiiiwwwcccccc
[Code]...
View 3 Replies
View Related
May 12, 2010
I am trying to create a regular expression in perl to remove all the delimiters (|) from a file. I was also thinking might I be able to use tr?
View 11 Replies
View Related
Jan 11, 2010
I need to get the modified date on a file in linux to use in a script.I tried using 'ls -l' on the file, but this caused problems when the date turned from a single digit into a double. The reason for the problem was because I was parsing the result string on spaces.How can I get the date of the last time a file was modified so I can use it in a script? For example, if a file was modified on 1/11/2010, I need the 11.
View 2 Replies
View Related
Jul 14, 2010
parsing the text file in perl.I have very large text file with plenty of columns and rows.how can i parse the file into Oracle database.
View 3 Replies
View Related
Mar 17, 2011
Is it possible to parse through a binary file using a script using either Korn shell or Bash
View 3 Replies
View Related
Feb 23, 2011
I'm working on a alias/script that will make it easier to look at my environment via the set command.
On my ubunto when running set it also displays some 10 pages of code pertaining to something called "imagemagik". at the end of the output. This code begins with the { character.
This is annoying if I want to look at my environment when working on scripts. How could I use something like grep, awk, sed, or whatever to ignore everything after the "{" character.
That seems to be the simplest way as long as there are no leading brackets in my environment. (And if you're thinking I should just remove {imagemagik}, I might just do that. But I still would like to know how to do this).
View 3 Replies
View Related
Sep 23, 2010
I did some searches and after a few hours was able to get what I needed. What I didn't find was a fully encompased means of what I'm used to in the windows world in working with delimted files. Hopefully this is helpful to others and if there is something better or leaner way, even better.We have an issue where managing printers, just viewing on RHEL w/ sys-conf-prtr we lose any number of, up to ~30 printers from lpadmin. Rather than stare and compare to find the missing ones, I wanted to make an intuitive script. This is what I came up with.
Code:
#!/bin/sh
while IFS="," read Prntr IP; do
[code]...
View 3 Replies
View Related
Jan 24, 2011
I have a variable in which the data is stored as below:
variable_test=0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s .....an so on.
There are lots of values in format like "3m1.057s" are stored in variable_test separated with an space between two such values. For exapmple, value is "3m1.057s" I need to save different parts of a value in three separate array variables such as the
var_hour=3
var_min=1
var_sec= 057
tell if this can be done using "awk". A "WHILE" loop might be used to separate and store theses values I guess?
View 1 Replies
View Related
Oct 13, 2010
I have a config file called hosts.cfg.
It contains entries like this:
Quote:
There are many more of these entries in the file, over 500, all in this same format: each host has a "define host" followed by 18 directives contained in squiggly brackets.
If I want to know all the hosts that are in the hostgroup called SERVER_GRP, I suppose I would need to read every hostgroups line (8th directive in squiggly brackets) that contains SERVER_GRP and output the corresponding host_name line (1st directive in squiggly brackets) from that entry.
View 3 Replies
View Related
Jul 9, 2009
parsing xml file using shell script and generate report in a PDF file
Xml file input:
<report>
<student name="x" father name="x1" class="first" Address="xyz">
<property name="sports" value="yes"/>
<property name="drawing" value="no"/>
[code]....
View 12 Replies
View Related
Aug 31, 2009
I have logs files from freeradius that have looks as follows:
$ grep "Login incorrect (rlm_ldap: User not found" /var/log/radius/radiusd-inner-tunnel-20090831.log
Mon Aug 31 09:25:27 2009 : Auth: Login incorrect (rlm_ldap: User not found): [John Doe] (from client oficina port 0 via TLS tunnel)
[code]....
I use the following line to get the amount of users that don't exist on ldap:
Code:
grep "Login incorrect (rlm_ldap: User not found" /var/log/radius/radiusd-inner-tunnel-20090831.log | awk '{print $14}' | sort -fu | wc -l
Now, awk on line one for example parses [John Doe] and [Joon Williams] as "[John" and that it's not what I'd want. I mean how could I do for awk looks username field as closed between squared brackets?
View 1 Replies
View Related
Mar 14, 2009
i wanted to know how can I pars a xml file (read data from xml file) and from C program.is there any function to do this for me in C.
View 1 Replies
View Related
Nov 9, 2010
I have a log file (test.log) starting & ending within dash (--) as below. I am looking to write a parser for test.log. This test.log file currently has single value for one Job ID but I wish to parse for repeated N values of different Job ID - Job, User, Queue, Dispatched Date, Dispatched Time, Completed Date, Completed Time, Hosts/Processor, CPU_T and TURNAROUND. I can either output this 10 values in another .log file or dump into cgi.
The selected parameters from test.log for parsing with above 10 attributes are -
--
Job <345010>
User <xyz>
Queue <gaussian>
[code]....
View 3 Replies
View Related
Jun 9, 2011
I managed to successfully install LAMP on my VPS and proceeded to install Wordpress only to run into an odd error.When I click on index.php, it starts to load but nothing happens.
The details:
LAMP = CentOS5.5, Apache 2.2.18(compiled from source), MySQL 5.1.57(compiled from source), PHP 5.3.6(from source too) My site: ottomatic.org as you can see in the index of files index.php is what I'm trying to load and if you check phpinfo.php you can see that PHP was installed correctly too. I added an .htaccess file with 644 permissions to my web root directory and that only seemed to produce an error, this is what I put in the .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
[Code]...
View 6 Replies
View Related
Aug 5, 2011
I need to autorise sendmail to send mail, but SeLinux blocks this action. But when I use this command:
Code:
setsebool -P httpd_can_sendmail=1
I receive an error
[code]...
View 3 Replies
View Related
Jul 21, 2011
I tried to upgrade ubuntu , downloaded everything that was needed but I am not able to install anything.
It gives an error
Code:
Do you want to continue [Y/n]? y
Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg: warning: parsing file '/var/lib/dpkg/available' near line 7174 package 'python-egenix-mxdatetime':
missing description
dpkg: error: parsing file '/var/lib/dpkg/available' near line 7175:
field name `Package(' must be followed by colon
E: Sub-process /usr/bin/dpkg returned an error code (2) since then I am not able to install anything on my aptdaemon fails for anything that I try to install How to deal with it
View 3 Replies
View Related
Dec 26, 2009
Im trying to figure out how to display parts of a .db file created by the scorch2000 server to display a player name, games played, score and maybe more...
here is the text file format example:
playername1 password email #ofgames score setting1 setting2 setting3
playername2 password email #ofgames score setting1 setting2 setting3
playername3 password email #ofgames score setting1 setting2 setting3
playername4 password email #ofgames score setting1 setting2 setting3
playername5 password email #ofgames score setting1 setting2 setting3
I dont want to display everything, of course ^^, but how do i get the player name, the number of games he played and his score to display it in a webpage in this fasion:
Name Games Played Score
joe blow1 25 9876890
joe blow2 31 8989767
joe blow2 26 7989767
joe blow2 17 5989767
joe blow2 13 4989767
and by highest score because the log doesin't put them in in score order....
please help, i asked the maker because he has one runing already but no answer back, well the game is pretty old so i didn't really expect an answer anyways and tryed to figure it out but i dont know functions in php, this is to include in a php-nuke block (this i know how to do
here is an example of a working page at the developper website:url
View 14 Replies
View Related
Aug 11, 2009
Is there a way to process individual characters one-by-one from a text file in Bash, or is that hoping for a little too much from this lovable old clunker?
View 13 Replies
View Related
Jun 8, 2011
How can i use different starting and ending delimiters in awk to search for strings or numbers like:
:string"another_string
'number+another_number
now i want string and number as output from above lines. But if i use delimiter as : or ' it will print the entire line coz second delimiter is not same as first one.
View 4 Replies
View Related
May 15, 2011
I have found ways to tar a directory and exclude certain directories but is there a way to simply tar multiple directories (they are in the same directory) in to one .tgz file?
View 8 Replies
View Related
Nov 4, 2009
I'm using my Linux (SLES 10) server as a File Server at this point. I need to set File Permissions to nested folders differently to different groups. For example:
homesharedengineering* should be read only for groupA
homesharedengineeringadmin should be read & write for groupB Plus read only for groupA
homesharedengineeringautocad should be read & write for groupC Plus read only for groupA
I've been using Webmin and Putty to set permissions but Putty only allows me the Default Group, it won't allow me to set several groups on the same directory. Webmin seems to allow me to add multiple groups (Webmin --> Others --> File Manager --> Info & ACL tab will provide extended abilities) but when I add multiple groups, they don't seem to take effect? I'm wondering if my setup at the 'Share' level or at the hierarchy of my folder structure (unix based) needs to be set specifically?
View 1 Replies
View Related
Mar 7, 2011
Is it possible to copy a file on multiple remote machines through scp in one command?
View 3 Replies
View Related
Mar 29, 2011
I have 100 files: cvd1.txt cvd2.txt ... cvd100.txt
How to gzip 100 files into one .gz file so that after I gunzip it, I should have cvd1.txt, cvd2.txt ... cvd100.txt separately?
View 4 Replies
View Related
Jun 12, 2009
I'm trying to transfer a directory, and all it's sub-directories and their contents, to another FTP server via SSH. I'm using CentOS Server 4.4. I can 'put' a single file, but can't figure out how to do everything at once, which I need to do.
View 5 Replies
View Related
Aug 5, 2010
I have a file with 5 columns. Column 4 contains numbers.Is it possible to split the file into multiple files using a condition for the contents of column 4 i.e if column 4 contains a value between 0-10 then print the lines to a new file called less_than_10.txt
View 1 Replies
View Related
May 11, 2010
I am trying to set-up a script that will go to the folder and attach all files from that folder to the email without having to specify name for each attached file.
Below script requires exact name of the file and then puts file context into the emails body.
cd /home/denis/Test/
mail -s "log files attached" smith_denis@ymail.com <log.txt
View 4 Replies
View Related
Jun 1, 2011
How to compile single file in Linux environment using gcc. Now i dont know how to use make file to compile multiple file.
View 5 Replies
View Related
Jun 17, 2009
I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:
check
try this
word1
word2
open space
list ..
I want to grep each line one by one. like I want it to
grep "check" *.log
grep "try this" *.log
grep "word1" *.log .. etc how can I do this?
and maybe write the output to a file.
View 5 Replies
View Related
Sep 15, 2010
Im new to the forum and fairly new to Linux as well. my apologies if this is posted in the wrong section. My problem is How can you search for a file in multiple machines (like a server farm) ? For example i log onto machine num1 and want to search for a file named "xxx.yyy" which may be in one of 4 machnies. What i do right now is manually log into each machine and run the find command. However i have heard that it is possible to do it via a couple of simple commands. I have looked into pssh and cssh as well as ssh tunneling (along with public key authentication to stop the machines requesting a password every time i log in) and unfortunately i was unable to find an answer.
View 4 Replies
View Related