Sponsored Content
Full Discussion: grep words from output file
Top Forums Shell Programming and Scripting grep words from output file Post 302534737 by DGPickett on Tuesday 28th of June 2011 03:34:03 PM
Old 06-28-2011
Maybe it deleted all the lines because they do not look like that? Or minor typo or two:
Code:
echo '
   TYPE(QCLUSTER)                          ALTDATE(2010-05-17)
   CLUSTER(QS.CL.MFT1)                 CLUSQMGR(QS.QM.BALT1)
' | sed '
  s/.*\(CLUSTER([^)]*)\).*\(CLUSQMGR([^)]*)\).*/dis \2 \1 channel/
  t
  d
 '
dis CLUSQMGR(QS.QM.BALT1) CLUSTER(QS.CL.MFT1) channel

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to from grep command from a file which contains matching words?

Hi all I have a file with below content (content is variable whenever new product is launched). I need form a grep command like this egrep "Unknown product|Invalid symboland so on" How to do it using a script? Unknown product Invalid symbol No ILX exch found exceeds maximum size AFX... (4 Replies)
Discussion started by: johnl
4 Replies

2. Shell Programming and Scripting

Splitting Concatenated Words in Input File with Words from a Master File

Hello, I have a complex problem. I have a file in which words have been joined together: Theboy ranslowly I want to be able to correctly split the words using a lookup file in which all the words occur: the boy ran slowly slow put child ly The lookup file which is meant for look up... (21 Replies)
Discussion started by: gimley
21 Replies

3. Shell Programming and Scripting

recursively Grep particular words among lines from a file

dear experts, Could you please help me to write a command/script to find follwing: from the log file i want to grep "resCode89270200100001552311" after that only "<resultCode>40614</resultCode>" it will be like that: resCode89270200100001552311 <resultCode>40614</resultCode> ... (7 Replies)
Discussion started by: thepurple
7 Replies

4. Shell Programming and Scripting

Grep multiple words in a single file

Hello All, I'm a newbie/rookie in Shell scipting. I've done oracle export of a table using Export utility. When I do export, it generates 2 files. 1> .dmp file 2> .dmp.log file. In .dmp.log file I have to search for a sentence which goes like '0 records have been inserted' and then... (2 Replies)
Discussion started by: samfisher
2 Replies

5. Shell Programming and Scripting

grep for words in file

Hi Please can you help me on this: How to grep for multiple words in a file, BUT for every word found output it to a new line. regards FR (8 Replies)
Discussion started by: fretagi
8 Replies

6. Shell Programming and Scripting

Grep words with spaces and save the output

I have a file that contains the schedule for a tournament with 41 teams. The team names have spaces in them. I would like to search for each teams schedule and then save that to that teams file For example Team name: "Team Two" I would like to search for all the games for "Team Two" and... (8 Replies)
Discussion started by: knijjar
8 Replies

7. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

8. Shell Programming and Scripting

How to grep a log file for words listed in separate text file?

Hello, I want to grep a log ("server.log") for words in a separate file ("white-list.txt") and generate a separate log file containing each line that uses a word from the "white-list.txt" file. Putting that in bullet points: Search through "server.log" for lines that contain any word... (15 Replies)
Discussion started by: nbsparks
15 Replies

9. Shell Programming and Scripting

Replace particular words in file based on if finds another words in that line

Hi All, I need one help to replace particular words in file based on if finds another words in that file . i.e. my self is peter@king. i am staying at north sydney. we all are peter@king. How to replace peter to sham if it finds @king in any line of that file. Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies

10. UNIX for Beginners Questions & Answers

Grep multiple words in a file with help of fixed string switch

I have multiple strings in a file which have special character $, when i search strings by ignoring $ with \ using single quotes it returns empty results. My search strings are set char_1($lock) and set new_char_clear_3($unlock) I tried searching with but it returns empty results.However... (3 Replies)
Discussion started by: g_eashwar
3 Replies
CLUSTER(7)						  PostgreSQL 9.2.7 Documentation						CLUSTER(7)

NAME
CLUSTER - cluster a table according to an index SYNOPSIS
CLUSTER [VERBOSE] table_name [ USING index_name ] CLUSTER [VERBOSE] DESCRIPTION
CLUSTER instructs PostgreSQL to cluster the table specified by table_name based on the index specified by index_name. The index must already have been defined on table_name. When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is subsequently updated, the changes are not clustered. That is, no attempt is made to store new or updated rows according to their index order. (If one wishes, one can periodically recluster by issuing the command again. Also, setting the table's FILLFACTOR storage parameter to less than 100% can aid in preserving cluster ordering during updates, since updated rows are kept on the same page if enough space is available there.) When a table is clustered, PostgreSQL remembers which index it was clustered by. The form CLUSTER table_name reclusters the table using the same index as before. You can also use the CLUSTER or SET WITHOUT CLUSTER forms of ALTER TABLE (ALTER_TABLE(7)) to set the index to be used for future cluster operations, or to clear any previous setting. CLUSTER without any parameter reclusters all the previously-clustered tables in the current database that the calling user owns, or all such tables if called by a superuser. This form of CLUSTER cannot be executed inside a transaction block. When a table is being clustered, an ACCESS EXCLUSIVE lock is acquired on it. This prevents any other database operations (both reads and writes) from operating on the table until the CLUSTER is finished. PARAMETERS
table_name The name (possibly schema-qualified) of a table. index_name The name of an index. VERBOSE Prints a progress report as each table is clustered. NOTES
In cases where you are accessing single rows randomly within a table, the actual order of the data in the table is unimportant. However, if you tend to access some data more than others, and there is an index that groups them together, you will benefit from using CLUSTER. If you are requesting a range of indexed values from a table, or a single indexed value that has multiple rows that match, CLUSTER will help because once the index identifies the table page for the first row that matches, all other rows that match are probably already on the same table page, and so you save disk accesses and speed up the query. CLUSTER can re-sort the table using either an index scan on the specified index, or (if the index is a b-tree) a sequential scan followed by sorting. It will attempt to choose the method that will be faster, based on planner cost parameters and available statistical information. When an index scan is used, a temporary copy of the table is created that contains the table data in the index order. Temporary copies of each index on the table are created as well. Therefore, you need free space on disk at least equal to the sum of the table size and the index sizes. When a sequential scan and sort is used, a temporary sort file is also created, so that the peak temporary space requirement is as much as double the table size, plus the index sizes. This method is often faster than the index scan method, but if the disk space requirement is intolerable, you can disable this choice by temporarily setting enable_sort to off. It is advisable to set maintenance_work_mem to a reasonably large value (but not more than the amount of RAM you can dedicate to the CLUSTER operation) before clustering. Because the planner records statistics about the ordering of tables, it is advisable to run ANALYZE(7) on the newly clustered table. Otherwise, the planner might make poor choices of query plans. Because CLUSTER remembers which indexes are clustered, one can cluster the tables one wants clustered manually the first time, then set up a periodic maintenance script that executes CLUSTER without any parameters, so that the desired tables are periodically reclustered. EXAMPLES
Cluster the table employees on the basis of its index employees_ind: CLUSTER employees USING employees_ind; Cluster the employees table using the same index that was used before: CLUSTER employees; Cluster all tables in the database that have previously been clustered: CLUSTER; COMPATIBILITY
There is no CLUSTER statement in the SQL standard. The syntax CLUSTER index_name ON table_name is also supported for compatibility with pre-8.3 PostgreSQL versions. SEE ALSO
clusterdb(1) PostgreSQL 9.2.7 2014-02-17 CLUSTER(7)
All times are GMT -4. The time now is 12:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy