Sponsored Content
Top Forums Shell Programming and Scripting Pattern search and save it as .txt file with some name.. Post 302529655 by j_panky on Friday 10th of June 2011 02:50:05 AM
Old 06-10-2011
Pattern search and save it as .txt file with some name..

Hello,
I have a note pad at /usr/abc location with the following content, since it is a huge file i need to split it into multiple .txt files.

Code:
A123|akdhj      |21kjsdff  |b212b1b21 |0
A123asdasd     |assdd     |asdasdsdqw|6
A123|QEWQ    |NMTGHJK |zxczxczx|3
A123|GEGBGH  |RTYBN    |xcvvxc|2
A123|VDFGER  |RYRYRTY |QRRWR|6
A123|RGEDFB   |YRTYTR |DFGDGDG|1
A123|DFRER    |WT3YTY |DGDGFG|2
A123|DFBDB    |QRQR     |QRQRQ|6
A123|DBDB     |WEWER   |QQQWER|8
A123|DBDBB   |WERWER  |YJTYJTY|0
Z213             |fasf        |afaf|afaffa|23
Z213             |asf        |afaf|afaffa|0
Z213             |FDDS        |afaf|afaffa|89
Z213             |RWER       |afaf|afaffa|8
Z213             |fQWE        |afaf|afaffa|8
Z213             |sdfdsf        |afaf|afaffa|7
Z213             |bfgh        |afaf|afaffa|3
Z213             |erter        |afaf|afaffa|1
Z213             |tyutyu        |afaf|afaffa|3
Z213             |rtret        |afaf|afaffa|9
Z213             |werwe        |afaf|afaffa|1

Above is the ac.txt file with huge content like this some starting with A123 some with Z213 and so on...
Now my requirement.

I want to read this file first search for A123 and save it in some other location containg all the records of A123, then search for Z213 and save it in some other location containg all the records of Z213 and so on..
Please suggest.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file for pattern and grab some lines before pattern

I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in) This is on solaris Can you help? (2 Replies)
Discussion started by: frustrated1
2 Replies

2. Shell Programming and Scripting

replace character in a string pattern and save the change in same file

I am facing one problem, can any one please suggest me the command for the same in unix. I am using Ksh. I have a large file with the data that looks like below. "ROTO2-2007f","_US01","9/15/2007","9/21/2007",346492,"NICK, LCD WATCH"97,1,"NAPOLITJ ","BERGER,M Z & CO INC",0.01, ... (2 Replies)
Discussion started by: mihir0011
2 Replies

3. Shell Programming and Scripting

How search,edit and save the file

Hi All, I want to edit a file using shell script..For ex...a file called /etc/passwd..here I am searching for "ftp" if it is there just change it to "tftp" without using any temporary file. (3 Replies)
Discussion started by: Vichu
3 Replies

4. UNIX for Dummies Questions & Answers

Save Excel file as .txt in UNIX format

I have some files created in Excel that have to be saved as .txt files in order to load them into our accounting system. I can save the files as .txt files through Excel, but I then have to open them in TextPad and do a save as to change the Format from PC to UNIX. Is there a way to skip this step... (2 Replies)
Discussion started by: jroyalty
2 Replies

5. Shell Programming and Scripting

"Time" command and save result in a file.txt

Hi, I'am using "time" to check execution time of some script. Is there any possibility to save time command result into a file ? (2 Replies)
Discussion started by: Physix
2 Replies

6. Shell Programming and Scripting

Want to read data from a file name.txt and search it in another file and then matching...

Hi Frnds... I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file.. I have a rough idea about the... (15 Replies)
Discussion started by: ektubbe
15 Replies

7. Shell Programming and Scripting

Search for a pattern in a String file and count the occurance of each pattern

I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported Input file is a free flowing file without any format example of output ERR-00001=5 .... ERR-01010=10 ..... ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies

8. Shell Programming and Scripting

Get the input from user and save it as .txt file

Hi friends, I am pretty new to shell scripting, please help me in this Scenario. for example, If I have one file called input.txt once I run the script, 1.It has to delete the old input.txt and create the new input.txt (if old input.txt is not there, no offence, just it has to create a... (2 Replies)
Discussion started by: Padmanabhan
2 Replies

9. Shell Programming and Scripting

How to use sed to search a particular pattern in a file backward after a pattern is matched.?

Hi, I have two files file1.txt and file2.txt. Please see the attachments. In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies

10. Shell Programming and Scripting

Save files in directory as txt

wget -x -i link.txt The above downloads and create unique entries for the 97 links in the text file. However, each new file is saved as CM080 with a FILE extention. Is there a way to convert each file in that directory to a .txt? The 97 files are in... (12 Replies)
Discussion started by: cmccabe
12 Replies
scrollkeeper(1) 						   User Commands						   scrollkeeper(1)

NAME
scrollkeeper, scrollkeeper.conf, scrollkeeper-get-cl, scrollkeeper-get-content-list, scrollkeeper-get-extended-content-list, scrollkeeper- get-index-from-docpath, scrollkeeper-get-toc-from-docpath, scrollkeeper-get-toc-from-id, scrollkeeper-install, scrollkeeper-rebuilddb, scrollkeeper-uninstall, scrollkeeper-update - manage document metadata SYNOPSIS
scrollkeeper-get-cl [-v] locale file scrollkeeper-get-content-list locale scrollkeeper-get-extended-content-list locale scrollkeeper-get-toc-from-docpath file scrollkeeper-get-toc-from-id series-id scrollkeeper-install [-p path] [-q] [-v] [-n] omf-file scrollkeeper-rebuilddb [-p path] [-q] [-v] [-o path] scrollkeeper-uninstall [-p path] [-q] [-v] omf-file scrollkeeper-update [-p path] [-q] [-v] [-n] [-o path] DESCRIPTION
scrollkeeper manages document metadata and keeps track of various document attributes such as language, format, subject, classification, copyright, and so on. scrollkeeper supports OMF (Open Metadata Format), which is a simple 16-element XML file format. OMF is a subset of the Dublin Core metadata specification developed by the Dublin Core Metadata Initiative. Currently, scrollkeeper can extract table of con- tents and index information only from DocBook documents. EXTENDED DESCRIPTION
The following commands are supported: scrollkeeper-get-cl Exports the scrollkeeper contents list for the specified locale and the specified contents file into a temporary file, and displays the name of the temporary file. scrollkeeper-get-content-list Exports the scrollkeeper contents list for the specified locale into a temporary file, and displays the name of the temporary file. scrollkeeper-get-extended-content-list Exports the scrollkeeper extended contents list for the specified locale into a temporary file, and displays the name of the temporary file. The extended contents list contains both the document tree and the table of contents for each document. scrollkeeper-get-toc-from-docpath Displays the path to the file containing the table of contents of a document registered in the OMF database. Otherwise, displays a mes- sage to indicate that the requested document is not installed. scrollkeeper-get-toc-from-id Displays the path to the file containing the table of contents of the document with the specified scrollkeeper series ID. scrollkeeper-install Registers a document in the scrollkeeper database. scrollkeeper-rebuilddb Removes the existing scrollkeeper database and creates a new database by registering the documents described by the OMF files found in the OMF search path. This command is useful if the scrollkeeper database becomes corrupted. For more information about the scroll- keeper-rebuilddb command, see the Examples section. scrollkeeper-uninstall Removes a document from the scrollkeeper database and removes any related files from the scrollkeeper database and contents lists. The document and the OMF file are not removed or modified. scrollkeeper-update Rescans the list of directories in the OMF search path for new and removed documents, and updates the scrollkeeper database accord- ingly. Unless a search path is specified with the -o option, all directories in the default OMF search path are rescanned. OPTIONS
The following options are supported: -n Use the network to retrieve the DTD if it is not available via the system's XML catalog. -o path Specifies the search path for OMF files. -p path Specifies the location of the scrollkeeper database. -q Suppresses warnings and error messages. -v Displays all warnings and error messages, in addition to logging these messages in the /var/log/scrollkeeper.log file. OPERANDS
The following operands are supported: file Specifies the location of the contents file. locale Specifies the locale. omf-file Specifies the location of the OMF file. series-id Specifies the scrollkeeper series ID. EXAMPLES
Example 1: Removing a Document From the scrollkeeper Database example% scrollkeeper-uninstall /usr/share/omf/example/filename.omf Example 2: Getting the scrollkeeper Extended Contents List for the C Locale example% scrollkeeper-get-extended-content-list C Example 3: Setting Up the scrollkeeper Database for a Diskless Client Clone Area example% scrollkeeper-rebuilddb -p /export/root/clone/Solaris_9/sun4u/var/lib/scrollkeeper -o /export/exec/Solaris_9_sparc.all/usr/share/omf If the scrollkeeper database must be installed in a location other than the standard location, use the -p path option to specify the loca- tion of the scrollkeeper database, where path is an empty directory. The scrollkeeper-rebuilddb command will not proceed if you specify a populated path for this option. If the OMF files must be read from a location other than the standard location, use the -o path option to specify the location of the OMF files. Specify the complete pathname, for example, /usr/share/omf. If you specify a partial pathname, for example, /usr/share, the scroll- keeper-rebuilddb command will take a long time, produce many warnings, and may crash. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of scrollkeeper: NLSPATH. OMF_PATH Provides scrollkeeper with an alternative list of directories in which to search for OMF files. This variable over- rides the default search path. If the list contains multiple directories, the entries should be separated by colons. EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /var/lib/scrollkeeper The location of the default scrollkeeper database. /var/log/scrollkeeper.log A log file containing log entries for database updates and error or warning messages. /usr/share/scrollkeeper The directory containing the scrollkeeper templates and xslt files. /etc/scrollkeeper.conf The default search path for omf files. /usr/bin/scrollkeeper-config The command-line executable for the scrollkeeper-config application. /usr/bin/scrollkeeper-get-cl The command-line executable for the scrollkeeper-get-cl application. /usr/bin/scrollkeeper-get-content-list The command-line executable for the scrollkeeper-get-content-list application. /usr/bin/scrollkeeper-get-extended-content-list The command-line executable for the scrollkeeper-get-extended-content-list application. /usr/bin/scrollkeeper-get-index-from-docpath The command-line executable for the scrollkeeper-get-index-from-docpath application. /usr/bin/scrollkeeper-get-toc-from-docpath The command-line executable for the scrollkeeper-get-toc-from-docpath application. /usr/bin/scrollkeeper-get-toc-from-id The command-line executable for the scrollkeeper-get-toc-from-id application. /usr/bin/scrollkeeper-install The command-line executable for the scrollkeeper-install application. /usr/bin/scrollkeeper-rebuilddb The command-line executable for the scrollkeeper-rebuilddb application. /usr/bin/scrollkeeper-uninstall The command-line executable for the scrollkeeper-uninstall application. /usr/bin/scrollkeeper-update The command-line executable for the scrollkeeper-update application. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-libs | +-----------------------------+-----------------------------+ |Interface stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
scrollkeeper-config(1), scrollkeeper-devel(1) NOTES
Written by Sander Vesik, Sun Microsystems Inc., 2003. Updated by Matt Keenan, Sun Microsystems Inc., 2006. Updated by Ghee Teo, Sun Microsystems Inc., 2007. SunOS 5.11 12 Sep 2006 scrollkeeper(1)
All times are GMT -4. The time now is 05:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy