Sponsored Content
Full Discussion: Extract 4 digit characters
Top Forums Shell Programming and Scripting Extract 4 digit characters Post 302746161 by Daniel Gate on Wednesday 19th of December 2012 12:36:49 AM
Old 12-19-2012
Extract 4 digit characters

HTML Code:
* hdisk99          U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140BA00000000  IBM MPIO FC 1750
* hdisk100         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140BB00000000  IBM MPIO FC 1750
* hdisk185         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140A000000000  IBM MPIO FC 1750
* hdisk186         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140A100000000  IBM MPIO FC 1750
* hdisk101         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C300000000  IBM MPIO FC 1750
* hdisk102         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C400000000  IBM MPIO FC 1750
* hdisk103         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C500000000  IBM MPIO FC 1750
* hdisk104         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C600000000  IBM MPIO FC 1750
* hdisk105         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C700000000  IBM MPIO FC 1750
* hdisk106         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C800000000  IBM MPIO FC 1750
* hdisk107         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140C900000000  IBM MPIO FC 1750
* hdisk108         U5791.001.9920BZ4-P1-C05-T1-W500507630E060C14-L401140CA00000000  IBM MPIO FC 1750
...
From the lists above, I need to pull out the first column and 4 characters from the block starting with L (i.e. L401140BA00000000).

The outputs need to be:

HTML Code:
hdisk99 11BA
PHP Code:
11BA 
comes from L401140BA00000000
L40XX40YY......., so XXYY is the one.

For this
PHP Code:
hdisk100  L401140BB00000000 
,
it is
PHP Code:
hdisk100  11BB 
because L401140BB00000000.

Please advise.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED to extract characters

Hi, Please let me know how do we write a piece of code to extract characters from a line using SED. (1 Reply)
Discussion started by: Shilpi
1 Replies

2. Shell Programming and Scripting

Replace one digit by two digit using sed

Folks, Is there a simple way to replace one digit by two digit using sed. Example, mydigit1918_2006_8_8_lag1.csv should be mydigit1918_2006_08_08_lag01.csv. I tried this way, but doesn't work. echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/' Thank you, (5 Replies)
Discussion started by: Jae
5 Replies

3. Shell Programming and Scripting

Extract string between two different characters

I want to extract a string from a line in a text file between two different characters: for example: :string" I want to extract string. It has to be done in a one-liner. (11 Replies)
Discussion started by: rein
11 Replies

4. UNIX for Dummies Questions & Answers

Replacing digit with characters in a file

Hi, I have a file with 40 columns out of which 15 are amount fields. There are approximately 6 mn records in this file. The file has data in following format: 123A,Ank,00.468,US,IL,780,53489 253A,Tng,-00.456,US,CA,452,46781 363A,nkk,-00.023,US,NJ,539,09625 I need to take all amount fields... (1 Reply)
Discussion started by: wahi80
1 Replies

5. UNIX for Dummies Questions & Answers

extract characters from a variable

Hi All, I have scenario as below, I want to cut the characters and store it variable2.. and want to display the variable2.. as shown below... eg: the size may differs , i am show just an example..... numbers are not fixed in variable1..i want to extract characters and... (1 Reply)
Discussion started by: G.K.K
1 Replies

6. Shell Programming and Scripting

extract last 8 characters from a file name

Dear gurus I have several files with the following format filenameCCYYMMDD , that is the last 8 characters will be the date in CCYYMMDD format. eg FILENAME20110523 . Could anyone please put me through on how to extract only the last 8 characters from the files. I am thinking of using awk,sed... (2 Replies)
Discussion started by: erinlomo
2 Replies

7. Shell Programming and Scripting

awk length of digit and print at most right digit

Have columns with digits and strings like: input.txt 3840 3841 3842 Dav Thun Tax Cahn 146; Dav. 3855 3853 3861 3862 Dav Thun Tax 2780 Karl VI., 3873 3872 3872 Dav Thun Tax 3894 3893 3897 3899 Dav Thun Tax 403; Thun 282. 3958 3959 3960 Dav Thun Tax 3972 3972 3972 3975 Dav Thun Tax... (8 Replies)
Discussion started by: sdf
8 Replies

8. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

9. Shell Programming and Scripting

awk to extract digit in line of text and create link

I am trying to extract the number in bold (leading zero removed) after Medexome_xx_numbertoextractin file and create an output using that extracted number. In the output the on thing that will change is the number the other test is static and will be the same each time. Thank you :). file ... (8 Replies)
Discussion started by: cmccabe
8 Replies

10. UNIX for Beginners Questions & Answers

Extract characters from a string name

Hi All, I am trying to extract only characters from a string value eg: abcdedg1234.cnf How can I extract only characters abcdedg and assign to a variable. Please help. Thanks (2 Replies)
Discussion started by: abhi_123
2 Replies
TR(4)							   BSD Kernel Interfaces Manual 						     TR(4)

NAME
tr -- TROPIC based shared memory Token-Ring cards device driver SYNOPSIS
tr0 at isa? port 0xa20 iomem 0xd800 irq ? tr* at isa? port ? irq ? tr* at isapnp? tr* at mca? slot ? tr* at pcmcia? function ? DESCRIPTION
The tr device driver supports TROPIC I based shared-memory Token-Ring cards. HARDWARE
Supported cards include the following IBM and 3Com models: IBM Token-Ring Network PC Adapter IBM Token-Ring Network PC Adapter II IBM Token-Ring Network Adapter/A IBM Token-Ring Network 16/4 Adapter IBM Token-Ring Network 16/4 Adapter/A IBM Token-Ring 16/4 Credit Card Adapter IBM Token Ring Auto 16/4 Credit Card Adapter IBM Turbo 16/4 Token Ring PC Card IBM 16/4 ISA Adapter IBM Auto 16/4 Token-Ring ISA Adapter IBM Token Ring 16/4 Credit Card Adapter IBM Token Ring Auto 16/4 Credit Card Adapter IBM Turbo 16/4 Token Ring PC Card 3Com 3C619 TokenLink 3Com 3C319 TokenLink Velocity 3Com 3C389 TokenLink Velocity PC Card SOURCE ROUTING
Setting IFF_LINK0 enables Token-Ring source routing. Setting IFF_LINK1 uses all-routes broadcasts otherwise single-route broadcasts are used. NOTES
The MCA attachment has been only tested on IBM Token Ring 16/4 Adapter/A so far. It doesn't support ifmedia(4) yet, too. SEE ALSO
ifmedia(4), intro(4), isa(4), isapnp(4), mca(4), pcmcia(4), ifconfig(8) HISTORY
The tr driver appeared in NetBSD 1.4. BUGS
The PCMCIA attachment does not work with the cbb(4) CardBus driver. BSD
April 14, 1999 BSD
All times are GMT -4. The time now is 06:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy