Sponsored Content
Top Forums Shell Programming and Scripting Concatenating and appending string based on specific pattern match Post 302380358 by patrick87 on Tuesday 15th of December 2009 02:21:36 AM
Old 12-15-2009
Concatenating and appending string based on specific pattern match

Input
Code:
#GEO-1-type-1-fwd-Initial  890 1519
OPKHIJEFVTEFVHIJEFVOPKHIJTOPKEFVHIJTEFVOPKOPKHIJHIJHIJTTOPKHIJHIJEFVEFVOPKHIJOPKHIJOPKEFVEFVOPKHIJHIJEFVHIJHIJEFVTHIJOPKOPKTEFVEFVEFVOPKHIJOPKOPKHIJTTEFVEFVTEFV

#GEO-1-type-2-fwd-Terminal  1572 2030
HIJOPKHIJEFVTOPKOPKTTOPKHIJOPKHIJEFVOPKTOPKTOPKHIJHIJTEFVOPKTOPKTOPKEFVOPKOPKEFVEFVTEFVOPKHIJEFVEFVOPKHIJOPKOPKHIJHIJEFVEFVHIJEFVEFVTOPKEFVOPKTHIJTTHIJOPK

#GEO-2-type-1-rev-Terminal  2734 2475
EFVTEFVTTOPKTOPKTEFVOPKHIJTEFVTTTOPKEFVTEFVOPKTTOPKTHIJTTTOPKEFVTOPKTEFVEFVEFVTHIJEFVHIJOPKEFVHIJOPKHIJEFVEFVHIJEFVEFVEFVTHIJEFVHIJOPKTHIJ

#GEO-2-type-2-rev-Internal  3041 2804
TEFVEFVOPKHIJTEFVHIJHIJHIJOPKOPKTTOPKHIJTOPKTOPKEFVEFVEFVEFVOPKHIJEFVTEFVTHIJTOPKHIJEFVOPKOPKTHIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK

#GEO-2-type-3-rev-Terminal  4050 3990
IJTOPKHIJEFVOPKOPKTHIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK

Output
Code:
#GEO-1-fwd 890 1519 1572 2030 
OPKHIJEFVTEFVHIJEFVOPKHIJTOPKEFVHIJTEFVOPKOPKHIJHIJHIJTTOPKHIJHIJEFVEFVOPKHIJOPKHIJOPKEFVEFVOPKHIJHIJEFVHIJHIJEFVTHIJOPKOPKTEFVEFVEFVOPKHIJOPKOPKHIJTTEFVEFVTEFVHIJOPKHIJEFVTOPKOPKTTOPKHIJOPKHIJEFVOPKTOPKTOPKHIJHIJTEFVOPKTOPKTOPKEFVOPKOPKEFVEFVTEFVOPKHIJEFVEFVOPKHIJOPKOPKHIJHIJEFVEFVHIJEFVEFVTOPKEFVOPKTHIJTTHIJOPK

#GEO-2-rev 4050 3990 3041 2804 2734 2475
IJTOPKHIJEFVOPKOPKTHIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPKTEFVEFVOPKHIJTEFVHIJHIJHIJOPKOPKTTOPKHIJTOPKTOPKEFVEFVEFVEFVOPKHIJEFVTEFVTHIJTOPKHIJEFVOPKOPKTHIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPKEFVTEFVTTOPKTOPKTEFVOPKHIJTEFVTTTOPKEFVTEFVOPKTTOPKTHIJTTTOPKEFVTOPKTEFVEFVEFVTHIJEFVHIJOPKEFVHIJOPKHIJEFVEFVHIJEFVEFVEFVTHIJEFVHIJOPKTHIJ

I would like to concatenating and appending the string content based on its header description. For those header description got "fwd",it append its content ascending. For those header description got "rev",it append its content descending. I trying the awk and perl do archive my desired goal now. Thanks a lot for any advice and suggestion.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

appending with sed based on matched pattern

Hi, I want to know if you can input with sed but instead of specifing a line number like below I wan't to be able to insert based on a specific word or patttern. 10i\ Insert me after line 10 is this possible with sed or should I use AWK? Thanks Jack (2 Replies)
Discussion started by: jack1981
2 Replies

3. Shell Programming and Scripting

Concatenating multiple lines to one line if match pattern

Hi all, I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file: Severity............: MAJORWARNING Summary: System temperature is out of normal range. Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies

4. Shell Programming and Scripting

Merge two file data together based on specific pattern match

My input: File_1: 2000_t g1110.b1 abb.1 2001_t g1111.b1 abb.2 abb.2 g1112.b1 abb.3 2002_t . . File_2: 2000_t Ali england 135 abb.1 Zoe british 150 2001_t Ali england 305 g1111.b1 Lucy russia 126 (6 Replies)
Discussion started by: patrick87
6 Replies

5. Shell Programming and Scripting

Paste two file side by side together based on specific pattern match problem

Input file_1: P78811 P40108 O17861 Q6NTW1 P40986 Q6PBK1 P38264 Q6PBK1 Q9CZ49 Q1GZI0 Input file_2: (6 Replies)
Discussion started by: patrick87
6 Replies

6. Shell Programming and Scripting

Appending string to match pattern (data processing)

Hello i have go the following result from performing 2 testing using the same file. I have used unix script to extract the result because the files are many as shown below. 01_gravity.f.tcov 7 3 42.86 02_gravity.f.tcov 9 4 80.86... (4 Replies)
Discussion started by: ganiel24
4 Replies

7. Shell Programming and Scripting

Filename pattern match and appending pipe

Hi, I have a directory with around 100k files and files with varying sizes(10GB files to as low as 5KB). All the files are having pipe dilimited records. I need to append 7 pipes to the end of each record, in each file whose name contains _X3_ and need to append 10 pipes to the end of each... (3 Replies)
Discussion started by: nss280
3 Replies

8. Shell Programming and Scripting

Help with replace line based on specific pattern match

Input file data20714 7327 7366 detail data20714 7327 7366 main data250821 56532 57634 detail data250821 57527 57634 main data250821 57359 57474 main data250821 57212 57301 main data250821 57140 57159 detail data250821 56834 57082 main data250821 56708 56779 main ... (3 Replies)
Discussion started by: perl_beginner
3 Replies

9. Shell Programming and Scripting

Concatenating many files based on a specific column contents

Dear all, I have many files(.csv) in a directory. I want to concatenate the files which have similar entries in a particular column and save into a new file like result_datetime.csv etc. One example file is like below. Sno,Step,Data1,Data2,Data3 etc. 1,0,2,3,4 2,1,3,4,5 3,2,0,1,1 ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

10. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
af_archive(5)							File Formats Manual						     af_archive(5)

NAME
af_archive -- format of archive files in the Attribute Filesystem SYNOPSIS
#include <atfs.h> #include <afsys.h> DESCRIPTION
AtFS archive files are used to store the data and attributes of non-busy ASOs. Beside these, some attributes (including all user defined attributes) of busy ASOs are stored in AtFS archive files. AtFS maintains two archive files for each line of development, one to hold the standard- and the user defined attributes and the other to hold the data and change notes. These files are stored either in a subdirectory named AtFS or in a explicitly named directory somewhere in your file system. The two archive files are named Attr/<filename> (attributes) and Data/<filename> (data). This manual contains a short, exemplary description of the archive structure. All data in AtFS-archives are stored as ASCII-strings. The archives contain keywords and keyletters. These are set in boldface in the following description. Strings of the form <field> describe the purpose of the appropriate field in the archive. Here's the structure (the attributes file first): The Header, ... ^BARHD <archive_format_version> <no_of_revisions> <size_of_data> ... the name .. ^BI <hostname> <path> <name> <type> <variant(unused)> ... and the owner .. ^BO <owner's_name> <owner's_host> <owner's_domain> ... followed by some attributes for the busy version ... ^BP <gen_> <rev_of_physical_predecessor> ^BL <locker's_name> <locker's_host> <locker's_domain> <date_of_last_lock_change> ... and the revision list, that contains all standard attributes for non-busy versions. ... ^BR <generation> <revision> <state> <mode> <variant(unused)> ^BA <author's_name> <_host> <_domain> <locker's_name> <_host> <_domain> ^BT <date_of_last_modification> <_last_access> <_last_status_change> ... ... <_saving> <_locking> ^BM <kind_of_representation> <size_of_file> <size_of_delta> ... ... <gen_> <rev_of_phys._successor> <gen_> <rev_of_phys._predecessor> ^BR ... ^BR ... ... Now follows the list of lists of user defined attributes ("-2 -2" indicates the busy version; "@" stands for a null byte). ... ^BUSEG ^BU -2 -2 machine=vax@data=fs@@ ^BU <gen> <rev> name=value@@ ^BU ... The structure of the datafile: Data are represented either by deltas or by complete data-chunks... ^BDATA <archive_format_version> ^BN <gen> <rev> <size_of_note> --- empty log message --- ^BD <gen> <rev> <kind_of_representation> <size_of_data> A typical delta looks like: @67723@@@@44@67756@^A14@some text@6635@ and so on. Deltas are indicated by a "1" at the "kind_of_representation" field. ^BN <gen> <rev> <size_of_note> This is a log message ^BD <gen> <rev> <kind_of_representation> <size_of_data> A "0" at the "kind_of_representation" field indicates that this version is stored completely. ^BN ... ^BD ... AUTHOR
Andreas Lampen, Tech. Univ. Berlin (andy@cs.tu-berlin.de) 1.6.119 af_archive(5)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy