Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract some characters from lines based on pattern Post 302997648 by RudiC on Wednesday 17th of May 2017 04:35:32 PM
Old 05-17-2017
Try also
Code:
awk 'match ($0, /{1:F.*2:I.../) {print substr ($0, RSTART+RLENGTH-3,3)}' file
103
103
103

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. HP-UX

extract field of characters after a specific pattern - using UNIX shell script

Hello, Below is my input file's content ( in HP-UX platform ): ABCD120672-B21 1 ABCD142257-002 1 ABCD142257-003 1 ABCD142257-006 1 From the above, I just want to get the field of 13 characters that comes after 'ABCD' i.e '120672-B21'... . Could... (2 Replies)
Discussion started by: jansat
2 Replies

2. Shell Programming and Scripting

extract lines based on few conditions

Hi, I need to extract lines based on some conditions as explained below: File format details: notes: 1. each set starts with AAA only 2. number of columns is fixed 3. number of rows per set may vary (as one set is upto DDD - 4 rows) Now, if any BBB's 5th column is blank then then... (4 Replies)
Discussion started by: prvnrk
4 Replies

3. Shell Programming and Scripting

extract based on pattern

I have a mail log file and I want to extract some lines belonging to one domain. For example Input File: Dec 12 03:15:28 postfix/smtpd: 3F481EB0295: client=unknown, sasl_method=PLAIN, sasl_username=abcd@xyz.com Dec 12 03:22:08 postfix/smtpd: 60B56EE001D: client=5ad9b9ba.com,... (7 Replies)
Discussion started by: Bijayant Kumar
7 Replies

4. Shell Programming and Scripting

Awk to extract lines with a defined number of characters

This is my problem, my file (file A) contains the following information: Now, I would like to create a file (file B) containing only the lines with 10 or more characters but less than 20 with their corresponding ID: Then, I need to compare the entries and determine their frequency. Thus, I... (7 Replies)
Discussion started by: Xterra
7 Replies

5. Shell Programming and Scripting

Sed or awk : pattern selection based on special characters

Hello All, I am here again scratching my head on pattern selection with special characters. I have a large file having around 200 entries and i have to select a single line based on a pattern. I am able to do that: Code: cat mytest.txt | awk -F: '/myregex/ { print $2}' ... (6 Replies)
Discussion started by: usha rao
6 Replies

6. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

7. Shell Programming and Scripting

Extract lines that match a pattern

Hi all, I got a file that contains the following content, Actually it is a part of the file content, Installing XYZ XYZA Image, API 18, revision 2 Unzipping XYZ XYZA Image, API 18, revision 2 (1%) Unzipping XYZ XYZA Image, API 18, revision 2 (96%) Unzipping XYZ XYZA Image, API 18,... (7 Replies)
Discussion started by: Kashyap
7 Replies

8. Shell Programming and Scripting

Precede and Append characters using sed/awk based on a pattern

I have an input file which is similar to what I have shown below. Pattern : Data followed by two blank lines followed by data again followed by two blank lines followed by data again etc.. The first three lines after every blank line combination(2 blank lines between data) should be... (2 Replies)
Discussion started by: bikerboy
2 Replies

9. Shell Programming and Scripting

Extract date from files based on file pattern

I want to extract dates from the files and i have different types of files with pattern. I have list file with the patterns and want to date extract based on it in a sh script Files in the directory : file1_20160101.txt file2_20160101_abc.txt filexyz20160101.txt list file with... (2 Replies)
Discussion started by: lijjumathew
2 Replies

10. UNIX for Beginners Questions & Answers

Extract file name based on the pattern

Hello All, I have multiple files in a hadoop /tmp/cloudera directory. Filename are as follows ABC_DATA_BAD5A_RO_F_20161104.CSV ABC_DATA_BAD6C_VR_F_20161202.CSV ABC_DATA_BAD7A_TR_F_20162104.CSV ABC_DATA_BAD2A_BR_F_20161803.CSV ABC_DATA_BAD3T_KT_F_20160106.CSV I just need filenames... (6 Replies)
Discussion started by: prajaktaraut
6 Replies
vfragpg(8)						      System Manager's Manual							vfragpg(8)

NAME
vfragpg - prints a single header page of a frag file SYNOPSIS
/sbin/advfs/vfragpg special page_LBN OPERANDS
Specifies the block special device name, such as /dev/disk/dsk2c. Specifies the logical block number of the page. DESCRIPTION
The vfragpg command allows you to see the structure of a single header page in a frag file. Use showfile -x /usr/.tags/1 to locate the logical block number of the page. RESTRICTIONS
You must have root user privileges to access this command. EXAMPLES
The following example shows the headers for the frag file with logical block number 10672 on the device /dev/disk/dsk3a: # vfragpg /dev/disk/dsk3a 10672 self 0 nextFreeGrp -1 fragType 6 freefrgs 14 ver 1 frag on free list : 43, nextFree = 49 frag on free list : 49, nextFree = 55 frag on free list : 55, nextFree = 61 frag on free list : 61, nextFree = 67 frag on free list : 67, nextFree = 73 frag on free list : 73, nextFree = 79 frag on free list : 79, nextFree = 85 frag on free list : 85, nextFree = 91 frag on free list : 91, nextFree = 97 frag on free list : 97, nextFree = 103 frag on free list : 103, nextFree = 109 frag on free list : 109, nextFree = 115 frag on free list : 115, nextFree = 121 frag on free list : 121, nextFree = -1 # SEE ALSO
advfs(4), showfile(8), shfragbf(8) vfragpg(8)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy