Sponsored Content
Top Forums UNIX for Dummies Questions & Answers To list everything except two files Post 302243939 by vidyadhar85 on Monday 6th of October 2008 09:35:59 PM
Old 10-06-2008
try
Code:
ls -lrt|awk '!/DIMStemp01.dbf/&&!/DIMSts01.dbf/{print}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

counting a list of string in a list of txt files

Hi there! I have 150 txt files named chunk1, chunk2, ........., chunk150. I have a second file called string.txt with more than 1000 unique strings, house, dog, cat ... I want to know which command I should use to count how many times each string appears in the 150 files. I have tried... (4 Replies)
Discussion started by: Pep Puigvert
4 Replies

2. Shell Programming and Scripting

I need a script to find socials in files and output a list of those files

I am trying to find socail security numbers in files in (and under) a specific directory and output a list of the files where they are found... the format would be with no dashes just 9 numeric characters in a row. I have tried this: find /DirToLookIn -exec grep '\{9\}' /dev/null {} \; >>... (1 Reply)
Discussion started by: NewSolarisAdmin
1 Replies

3. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

4. Shell Programming and Scripting

find list of files from a list and copy to a directory

I will be very grateful if someone can help me with bash shell script that does the following: I have a list of filenames: A01_155716 A05_155780 A07_155812 A09_155844 A11_155876 that are kept in different sub directories within my current directory. I want to find these files and copy... (3 Replies)
Discussion started by: manishabh
3 Replies

5. Shell Programming and Scripting

how to copy files followed by list of names of all the files in /etc?

....... (2 Replies)
Discussion started by: pcbuilder
2 Replies

6. Shell Programming and Scripting

List files only when a certain number of files match

Hi, I have many files named CCR20110720011001.CTRD CCR20110720011501.CTRD CCR20110720012001.CTRD CCR20110720012501.CTRD CCR20110720021001.CTRD ... (9 Replies)
Discussion started by: shadyfright
9 Replies

7. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

8. Shell Programming and Scripting

Copy list of files from a keyword list to another directory

Hello, I have a folder with a massive amount of files, and I want to copy out a specific subset of the files to a new directory. I would like to use a text file with the filenames listed, but can't get it to work. The thing I'm hung up on is that the folder names in the path can and do have... (5 Replies)
Discussion started by: twjolson
5 Replies

9. Shell Programming and Scripting

List all the files in the present path and Folders and subfolders files also

Hi, I need a script/command to list out all the files in current path and also the files in folder and subfolders. Ex: My files are like below $ ls -lrt total 8 -rw-r--r-- 1 abc users 419 May 25 10:27 abcd.xml drwxr-xr-x 3 abc users 4096 May 25 10:28 TEST $ Under TEST, there are... (2 Replies)
Discussion started by: divya bandipotu
2 Replies

10. UNIX for Beginners Questions & Answers

Comparing two files and list the difference with common first line content of both files

I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ? Source File ************* # file: /local/test_1 # owner: own #... (4 Replies)
Discussion started by: sarathy_a35
4 Replies
XBase::Index(3pm)					User Contributed Perl Documentation					 XBase::Index(3pm)

NAME
XBase::Index - base class for the index files for dbf SYNOPSIS
use XBase; my $table = new XBase "data.dbf"; my $cur = $table->prepare_select_with_index("id.ndx", "ID", "NAME); $cur->find_eq(1097); while (my @data = $cur->fetch()) { last if $data[0] != 1097; print "@data "; } This is a snippet of code to print ID and NAME fields from dbf data.dbf where ID equals 1097. Provided you have index on ID in file id.ndx. You can use the same code for ntx and idx index files. For the cdx and mdx, the prepare_select call would be prepare_select_with_index(['rooms.cdx', 'ROOMNAME']) so instead of plain filename you specify an arrayref with filename and an index tag in that file. The reason is that cdx and mdx can contain multiple indexes in one file and you have to distinguish, which you want to use. DESCRIPTION
The module XBase::Index is a collection of packages to provide index support for XBase-like dbf database files. An index file is generaly a file that holds values of certain database field or expression in sorted order, together with the record number that the record occupies in the dbf file. So when you search for a record with some value, you first search in this sorted list and once you have the record number in the dbf, you directly fetch the record from dbf. What indexes do To make the searching in this ordered list fast, it's generally organized as a tree -- it starts with a root page with records that point to pages at lower level, etc., until leaf pages where the pointer is no longer a pointer to the index but to the dbf. When you search for a record in the index file, you fetch the root page and scan it (lineary) until you find key value that is equal or grater than that you are looking for. That way you've avoided reading all pages describing the values that are lower. Here you descend one level, fetch the page and again search the list of keys in that page. And you repeat this process until you get to the leaf (lowest) level and here you finaly find a pointer to the dbf. XBase::Index does this for you. Some of the formats also support multiple indexes in one file -- usually there is one top level index that for different field values points to different root pages in the index file (so called tags). XBase::Index supports (or aims to support) the following index formats: ndx, ntx, mdx, cdx and idx. They differ in a way they store the keys and pointers but the idea is always the same: make a tree of pages, where the page contains keys and pointer either to pages at lower levels, or to dbf (or both). XBase::Index only supports read only access to the index fields at the moment (and if you need writing them as well, follow reading because we need to have the reading support stable before I get to work on updating the indexes). Testing your index file (and XBase::Index) You can test your index using the index_dump script (I mean test XBase::Index on correct index data, not testing corrupted index file, of course ;-) Just run index_dump ~/path/index.ndx index_dump ~/path/index.cdx tag_name or perl -Ilib `which index_dump` ~/path/index.cdx tag_name if you haven't installed this version of XBase.pm/DBD::XBase yet. You should get the content of the index file. On each row, there is the key value and a record number of the record in the dbf file. Let me know if you get results different from those you expect. I'd probably ask you to send me the index file (and possibly the dbf file as well), so that I can debug the problem. The index file is (as already noted) a complement to a dbf file. Index file without a dbf doesn't make much sense because the only thing that you can get from it is the record number in the dbf file, not the actual data. But it makes sense to test -- dump the content of the index to see if the sequence is OK. The index formats usually distinguish between numeric and character data. Some of the file formats include the information about the type in the index file, other depend on the dbf file. Since with index_dump we only look at the index file, you may need to specify the -type option to index_dump if it complains that it doesn't know the data type of the values (this is the case with cdx at least). The possible values are num, char and date and the call would be like index_dump -type=num ~/path/index.cdx tag_name (this -type option may not work with all index formats at the moment -- will be fixed and patches always welcome). You can use "-ddebug" option to index_dump to see how pages are fetched and decoded, or run debugger to see the calls and parsing. Using the index files to speed up searches in dbf The syntax for using the index files to access data in the dbf file is generally my $table = new XBase "tablename"; # or any other arguments to get the XBase object # see XBase(3) my $cur = $table->prepare_select_with_index("indexfile", "list", "of", "fields", "to", "return"); or my $cur = $table->prepare_select_with_index( [ "indexfile_with_tags", "tag_name" ], "list", "of", "fields", "to", "return"); where we specify the tag in the index file (this is necessary with cdx and mdx). After we have the cursor, we can search to given record and start fetching the data: $cur->find_eq('jezek'); while (my @data = $cur->fetch) { # do something Supported index formats The following table summarizes which formats are supproted by XBase::Index. If the field says something else that Yes, I welcome testers and offers of example index files. Reading of index files -- types supported by XBase::Index type string numeric date ---------------------------------------------------------- ndx Yes Yes Yes (you need to convert to Julian) ntx Yes Yes Untested idx Untested Untested Untested (but should be pretty usable) mdx Untested Untested Untested cdx Yes Yes Untested Writing of index files -- not supported untill the reading is stable enough. So if you have access to an index file that is untested or unsupported and you care about support of these formats, contact me. If you are able to actually generate those files on request, the better because I may need specific file size or type to check something. If the file format you work with is supported, I still appreciate a report that it really works for you. Please note that there is very little documentation about the file formats and the work on XBase::Index is heavilly based on making assumption based on real life data. Also, the documentation is often wrong or only describing some format variations but not the others. I personally do not need the index support but am more than happy to make it a reality for you. So I need your help -- contact me if it doesn't work for you and offer me your files for testing. Mentioning word XBase somewhere in the Subject line will get you (hopefully ;-) fast response. Mentioning work Help or similar stupidity will probably make my filters to consider your email as spam. Help yourself by making my life easier in helping you. Programmer's notes Programmers might find the following information useful when trying to debug XBase::Index from their files: The XBase::Index module contains the basic XBase::Index package and also packages XBase::ndx, XBase::ntx, XBase::idx, XBase::mdx and XBase::cdx, and for each of these also a package XBase::index_type::Page. Reading the file goes like this: you create as object calling either new XBase::Index or new XBase::ndx (or whatever the index type is). This can also be done behind the scenes, for example XBase::prepare_select_with_index calls new XBase::Index. The index file is opened using the XBase::Base::new/open and then the XBase::index_type::read_header is called. This function fills the basic data fields of the object from the header of the file. The new method returns the object corresponding to the index type. Then you probably want to do $index->prepare_select or $index->prepare_select_eq, that would possition you just before record equal or greater than the parameter (record in the index file, that is). Then you do a series of fetch'es that return next pair of (key, pointer_to_dbf). Behind the scenes, prepare_select_eq or fetch call XBase::Index::get_record which in turn calls XBase::index_type::Page::new. From the index file perspective, the atomic item in the file is one index page (or block, or whatever you call it). The XBase::index_type::Page::new reads the block of data from the file and parses the information in the page -- pages have more or less complex structures. Page::new fills the structure, so that the fetch calls can easily check what values are in the page. For some examples, please see eg/use_index in the distribution directory. VERSION
1.02 AVAILABLE FROM
http://www.adelton.com/perl/DBD-XBase/ AUTHOR
(c) 1998--2011 Jan Pazdziora. SEE ALSO
XBase(3), XBase::FAQ(3) perl v5.12.4 2011-08-31 XBase::Index(3pm)
All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy