Sponsored Content
Top Forums Shell Programming and Scripting Comparing Counts Within Separate Files Post 302156926 by gator76 on Wednesday 9th of January 2008 02:53:46 PM
Old 01-09-2008
Thank you for your reply.

I guess the crux of what I'm asking is, is there a way to specify which in a list of files your "pointer" points to?

So, when you have a variable that looks like FILELIST="$file1A $file1B...", how can you pull, say, the third variable from that list, without stating the name of the variable explicitly. I'm assuming the shell somehow stores a "bookmark", so to speak, of where it currently is in that list, or else the for loop wouldn't work. How can I find and use that bookmark to compare these files, if there is a way.

I don't really understand the eval statement, but through doing some testing, it doesn't seem to behave much differently than just the for statement itself (for fname in $files).

Please excuse my ignorance. I know just enough ksh scripting to be dangerous! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to compare counts in two separate files

Hi all, what will be the code to compare count present in two seperate files for e.g file (a) contains counts 100 and file (b) contains records 90 since both these files have differnt count so it will display count didnt match and in case of success it display (5 Replies)
Discussion started by: jojo123
5 Replies

2. Shell Programming and Scripting

Get counts for multiple files

How do get the counts by excluding header and tailer. wc -l customer_data*.0826 31 customer_data_1.0826 57 customer_data_2.0826 456 customer_data_3.0826 668 customer_data_4.0826 789 customer_data_5.0826 2344 customer_data_6.0826 13457 customer_data_7.0826... (6 Replies)
Discussion started by: zooby
6 Replies

3. Shell Programming and Scripting

Sending e-mail of record counts in 3 or more files

I am trying to load data into 3 tables simultaneously (which is working fine). Then when loaded, it should count the total number of records in all the 3 input files and send an e-mail to the user. The script is working fine, as far as loading all the 3 input files into the database tables, but... (3 Replies)
Discussion started by: msrahman
3 Replies

4. Shell Programming and Scripting

Need to combine counts from diff files

Ok i have a script that goes into the last 3 files, grabs a value from that file which is a date, counts the number of results of that date. So this is the output: FILED001.20110407.175709.086912 49995 04-07T12 4 04-07T07 1 04-07T17 FILED001.20110407.180111.086913 50000 04-07T12 ... (5 Replies)
Discussion started by: cinderella
5 Replies

5. Shell Programming and Scripting

Divide data into separate files

frnds: i want to divide data on the behalf of dotted line and redirectd into new files ) ------------------------- M-GET CONFIRMATION ( ------------------------- M-GET CONFIRMATION ( INVOKE IDENTIFIER final data shuld be into 3 files ...... (6 Replies)
Discussion started by: dodasajan
6 Replies

6. Shell Programming and Scripting

Comparing columns in two separate files

Hey all, I have a file structure that looks something like this: file1 306708278 88954535 234167885 file2 2012-03-27T12:32:56+00:00 137 Orchotorena 184616310003601409 306708278 es 40.4777947 Majadahonda -3.6416896333333333 0 false atlante83 "<a href=""http://tapbots.com/tweetbot""... (8 Replies)
Discussion started by: dgaff
8 Replies

7. Shell Programming and Scripting

Using bash to separate files files based on parts of a filename

Hey guys, Sorry for the basic question but I have a lot of files that I want to separate into groups based on filenames which I can then cat together. Eg I have: (a_b_c.txt) WB34_2_SLA8.txt WB34_1_SLA8.txt WB34_1_DB10.txt WB34_2_DB10.txt WB34_1_SLA8.txt WB34_2_SLA8.txt 77_1_SLA8.txt... (1 Reply)
Discussion started by: Breentax
1 Replies

8. Web Development

Two separate domains - and files

Hi, I've been asked to 'troubleshoot' a webserver where two different TLDs are being served. Or to be more accurate, 'domain.com' and 'domain.fr'. So we have /var/www/domain.com /var/www/domain.fr And then for some reason, the httpd.conf file points to two different configuration files.... (1 Reply)
Discussion started by: davidm123SED
1 Replies

9. Shell Programming and Scripting

Output in separate files

Hi all, i have the bash script for remote conection, for hosts in $(cat /list); do ssh user1@$hosts "hostname"; done execute hostname command by all hosts and show standar ouput, how i can send to file by each host in lists, so e.g. $cat list 10.0.0.1 10.0.0.2... (1 Reply)
Discussion started by: aav1307
1 Replies

10. Shell Programming and Scripting

Need separate vi files in shell

Input: I have input file below mentioned.Input file has Yahoo,gmail,yuimn etc..are websites and there are users listed under it. I have many other unique websites but i mentioned just few as below. For example: Yahoo is website and 123,fsfd are members of website "yahoo". See below input... (19 Replies)
Discussion started by: buzzme
19 Replies
Glib::BookmarkFile(3)					User Contributed Perl Documentation				     Glib::BookmarkFile(3)

NAME
Glib::BookmarkFile - Parser for bookmark files SYNOPSIS
use Glib; $date .= $_ while (<DATA>); $b = Glib::BookmarkFile->new; $b->load_from_data($data); $uri = 'file:///some/path/to/a/file.txt'; if ($b->has_item($uri)) { $title = $b->get_title($uri); $desc = $b->get_description($uri); print "Bookmark for `$uri' ($title): "; print " $desc "; } 0; __DATA__ <?xml version="1.0" encoding="UTF-8"?> <xbel version="1.0" xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks" xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"> <bookmark href="file:///tmp/test-file.txt" added="2006-03-22T18:54:00Z" modified="2006-03-22T18:54:00Z" visited="2006-03-22T18:54:00Z"> <title>Test File</title> <desc>Some test file</desc> <info> <metadata owner="http://freedesktop.org"> <mime:mime-type type="text/plain"/> <bookmark:applications> <bookmark:application name="Gedit" exec="gedit %u" timestamp="1143053640" count="1"/> </bookmark:applications> </metadata> </info> </bookmark> </xbel> DESCRIPTION
Glib::BookmarkFile lets you parse, edit or create files containing lists of bookmarks to resources pointed to by URIs, with some meta-data bound to them, following the Desktop Bookmark Specification. The recent files support inside GTK+ uses this type of files to store the list of recently used files. The syntax of bookmark files is described in detail in the Desktop Bookmarks Specification, here is a quick summary: bookmark files use a subclass of the XML Bookmark Exchange Language (XBEL) document format, defining meta-data such as the MIME type of the resource pointed by a bookmark, the list of applications that have registered the same URI and the visibility of the bookmark. METHODS
bookmarkfile = Glib::BookmarkFile->new $bookmark_file->add_application ($uri, $name, $exec) o $uri (string) o $name (string or undef) o $exec (string or undef) Adds the application with $name and $exec to the list of applications that have registered a bookmark for $uri into $bookmark_file. Every bookmark inside a "Glib::BookmarkFile" must have at least an application registered. Each application must provide a name, a command line useful for launching the bookmark, the number of times the bookmark has been registered by the application and the last time the application registered this bookmark. If $name is undef, the name of the application will be the same returned by Glib::get_application_name(); if $exec is undef, the command line will be a composition of the program name as returned by Glib::get_prgname() and the "%u" modifier, which will be expanded to the bookmark's URI. This function will automatically take care of updating the registrations count and timestamping in case an application with the same $name had already registered a bookmark for $uri inside the bookmark file. If no bookmark for $uri is found one is created. $bookmark_file->add_group ($uri, $group) o $uri (string) o $group (string) Adds $group to the list of groups to which the bookmark for $uri belongs to. If no bookmark for $uri is found one is created. unix timestamp = $bookmark_file->get_added ($uri) o $uri (string) $bookmark_file->set_added ($uri, $value) o $uri (string) o $value (unix timestamp) Sets the time the bookmark for $uri was added. If no bookmark for $uri is found one is created. ($exec, $count, $stamp) = $bookmark_file->get_app_info ($uri, $name) o $uri (string) o $name (string) Gets the registration informations of $name for the bookmark for $uri. See Glib::BookmarkFile::set_app_info() for more informations about the returned data. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_app_info ($uri, $name, $exec, $count, $stamp) o $uri (string) o $name (string) o $exec (string) o $count (integer) o $stamp (unix timestamp) Sets the meta-data of application $name inside the list of applications that have registered a bookmark for $uri inside $bookmark_file. You should rarely use this method; use Glib::BookmarkFile::add_application() and Glib::BookmarkFile::remove_application() instead. $name can be any UTF-8 encoded string used to identify an application. $exec can have one of these two modifiers: "%f", which will be expanded as the local file name retrieved from the bookmark's URI; "%u", which will be expanded as the bookmark's URI. The expansion is done automatically when retrieving the stored command line using the Glib::BookmarkFile::get_app_info() method. $count is the number of times the application has registered the bookmark; if it is < 0, the current registration count will be increased by one, if it is 0, the application with $name will be removed from the list of registered applications. $stamp is the Unix time of the last registration, as returned by time(); if it is -1, the current time will be used. If you try to remove an application by setting its registration count to zero, and no bookmark for $uri is found, %FALSE is returned and an exception is fired. May croak with a Glib::Error in $@ on failure. list = $bookmark_file->get_applications ($uri) o $uri (string) Retrieves the names of the applications that have registered the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->get_description ($uri) o $uri (string) Gets the description of the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_description ($uri, $description) o $uri (string) o $description (string) Sets the description of the bookmark for $uri. If no bookmark for $uri is found one is created. list = $bookmark_file->get_groups ($uri) o $uri (string) Retrieves the list of group names of the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_groups ($uri, ...) o $uri (string) o ... (list) one or more group names Sets a list of group names for the item with URI $uri. Each previously set group name list is removed. If no bookmark for $uri is found one is created. boolean = $bookmark_file->has_application ($uri, $name) o $uri (string) o $name (string) Checks whether the bookmark for $uri inside $bookmark_file has been registered by application $name. May croak with a Glib::Error in $@ on failure. boolean = $bookmark_file->has_group ($uri, $group) o $uri (string) o $group (string) Checks whether $group appears in the list of groups to which the bookmark for $uri belongs to. May croak with a Glib::Error in $@ on failure. boolean = $bookmark_file->has_item ($uri) o $uri (string) Looks whether the bookmark file has a bookmark for $uri. ($href, $mime_type) = $bookmark_file->get_icon ($uri) o $uri (string) Gets the icon of the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_icon ($uri, $href, $mime_type) o $uri (string) o $href (string or undef) o $mime_type (string or undef) Sets the icon for the bookmark for $uri. If $href is undef, unsets the currently set icon. boolean = $bookmark_file->get_is_private ($uri) o $uri (string) May croak with a Glib::Error in $@ on failure. $bookmark_file->set_is_private ($uri, $is_private) o $uri (string) o $is_private (boolean) $bookmark_file->load_from_data ($buf) o $buf (scalar) Parses a string containing a bookmark file structure. May croak with a Glib::Error in $@ on failure. ($full_path) = $bookmark_file->load_from_data_dirs ($file) o $file (localized file name) Parses a bookmark file, searching for it inside the data directories. If a file is found, it returns the full path. May croak with a Glib::Error in $@ on failure. $bookmark_file->load_from_file ($file) o $file (localized file name) Parses a bookmark file. May croak with a Glib::Error in $@ on failure. string = $bookmark_file->get_mime_type ($uri) o $uri (string) Gets the MIME type of the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_mime_type ($uri, $mime_type) o $uri (string) o $mime_type (string) Sets the MIME type of the bookmark for $uri. If no bookmark for $uri is found one is created. unix timestamp = $bookmark_file->get_modified ($uri) o $uri (string) $bookmark_file->set_modified ($uri, $value) o $uri (string) o $value (unix timestamp) Sets the time the bookmark for $uri was last modified. If no bookmark for $uri is found one is created. $bookmark_file->move_item ($old_uri, $new_uri) o $old_uri (string) o $new_uri (string or undef) Changes the URI of a bookmark item from $old_uri to $new_uri. Any existing bookmark for $new_uri will be overwritten. If $new_uri is undef, then the bookmark is removed. May croak with a Glib::Error in $@ on failure. $bookmark_file->remove_application ($uri, $name) o $uri (string) o $name (string) Removes application registered with $name from the list of applications that have registered a bookmark for $uri inside $bookmark_file. May croak with a Glib::Error in $@ on failure. $bookmark_file->remove_group ($uri, $group) o $uri (string) o $group (string) Removes $group from the list of groups to which the bookmark for $uri belongs to. May croak with a Glib::Error in $@ on failure. $bookmark_file->remove_item ($uri) o $uri (string) Removes the bookmark for $uri from the bookmark file. May croak with a Glib::Error in $@ on failure. integer = $bookmark_file->get_size Gets the number of bookmarks inside the bookmark file. $bookmark_file->get_title ($uri, $title) o $uri (string) Gets the title of the bookmark for $uri. May croak with a Glib::Error in $@ on failure. $bookmark_file->set_title ($uri, $title) o $uri (string) o $title (string) Sets the title of the bookmark for $uri. If no bookmark for $uri is found one is created. string = $bookmark_file->to_data Returns the bookmark file as a string. May croak with a Glib::Error in $@ on failure. $bookmark_file->to_file ($file) o $file (localized file name) Saves the contents of a bookmark file into a file. The write operation is guaranteed to be atomical by writing the contents of the bookmark file to a temporary file and then moving the file to the target file. May croak with a Glib::Error in $@ on failure. list = $bookmark_file->get_uris Returns the URI of all the bookmarks in the bookmark file. unix timestamp = $bookmark_file->get_visited ($uri) o $uri (string) $bookmark_file->set_visited ($uri, $value) o $uri (string) o $value (unix timestamp) Sets the time the bookmark for $uri was last visited. If no bookmark for $uri is found one is created. SEE ALSO
Glib COPYRIGHT
Copyright (C) 2003-2009 by the gtk2-perl team. This software is licensed under the LGPL. See Glib for a full notice. perl v5.12.1 2010-07-05 Glib::BookmarkFile(3)
All times are GMT -4. The time now is 03:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy