need to extract field of characters in a line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need to extract field of characters in a line
Prev   Next
# 1  
Old 05-22-2008
need to extract field of characters in a line

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 you please let me know the shell script that I have to use?

Thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies

2. UNIX for Dummies Questions & Answers

awk if one field has more characters than another

Hi all, I've been stuck on how to write a command in awk that looks at two columns and only prints entries where one of the columns has more than or less than a 3 character difference. I need to be able to compare any two columns preferably, but as an example, comparing columns 3 and 4 example... (9 Replies)
Discussion started by: torchij
9 Replies

3. 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

4. Shell Programming and Scripting

sed to replace a field from a line with another field

i have something like this, cat filename.txt hui this si s"dfgdfg" omeone ipaddress="10.19.123.104" wel hope this works i want to replace only 10.19.123.104 with different ip say 10.19.123.103 i tried this sed -i "s/'ipaddress'/'ipaddress=10.19.123.103'/g" filename.txt ... (1 Reply)
Discussion started by: vivek d r
1 Replies

5. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

6. UNIX Desktop Questions & Answers

Extract third field of third line

Hi, how do I extract the third field of the first line? I know how to get the first line or the third field of a file, but I can't get the single entry. awk 'NR==1' file.txt awk '{print $3}' file.txt Please tell me how to combine these. And how do I set this value into a variable? ... (1 Reply)
Discussion started by: etownbetty
1 Replies

7. Shell Programming and Scripting

TO Extract Last 10 Characters from a line

Hi Guys!!!!!!!!!!! How do we extract last 13 characters from a line I/p: .R1/new/sv902a.01.per O/p: sv902a.01.per And the no of characters differs in each line.. Kindly help me out in this!!!!!!!!!!! Thanks in Advance (4 Replies)
Discussion started by: aajan
4 Replies

8. 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

9. Shell Programming and Scripting

AWK line by line instead of field by field?

I've been using a lot of awk lately for csv files. But I've been using awk for csv files that contain 32 fields per line. For the first time, I've been given a csv file that contains one field per line (13 fields in each csv file). I need to check that a specific field, or line contains a... (2 Replies)
Discussion started by: yongho
2 Replies
Login or Register to Ask a Question
OD(1)							    BSD General Commands Manual 						     OD(1)

NAME
od -- octal, decimal, hex, ASCII dump SYNOPSIS
od [-aBbcDdeFfHhIiLlOosvXx] [-A base] [-j skip] [-N length] [-t type] [[+]offset[.][Bb]] [file ...] DESCRIPTION
The od utility is a filter which displays the specified files, or standard input if no files are specified, in a user specified format. The options are as follows: -A base Specify the input address base. base may be one of d, o, x or n, which specify decimal, octal, hexadecimal addresses or no address, respectively. -a Output named characters. Equivalent to -t a. -B, -o Output octal shorts. Equivalent to -t o2. -b Output octal bytes. Equivalent to -t o1. -c Output C-style escaped characters. Equivalent to -t c. -D Output unsigned decimal ints. Equivalent to -t u4. -e, -F Output double-precision floating point numbers. Equivalent to -t fD. -f Output single-precision floating point numbers. Equivalent to -t fF. -H, -X Output hexadecimal ints. Equivalent to -t x4. -h, -x Output hexadecimal shorts. Equivalent to -t x2. -I, -L, -l Output signed decimal longs. Equivalent to -t dL. -i Output signed decimal ints. Equivalent to -t dI. -j skip Skip skip bytes of the combined input before dumping. The number may be followed by one of b, k or m which specify the units of the number as blocks (512 bytes), kilobytes and megabytes, respectively. -N length Dump at most length bytes of input. -O Output octal ints. Equivalent to -t o4. -s Output signed decimal shorts. Equivalent to -t d2. -t type Specify the output format. type is a string containing one or more of the following kinds of type specifiers: a Named characters (ASCII). Control characters are displayed using the following names: 000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ 006 ACK 007 BEL 008 BS 009 HT 00a NL 00b VT 00c FF 00d CR 00e SO 00f SI 010 DLE 011 DC1 012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB 018 CAN 019 EM 01a SUB 01b ESC 01c FS 01d GS 01e RS 01f US 020 SP 0ff DEL c Characters in the default character set. Non-printing characters are represented as 3-digit octal character codes, except the following characters, which are represented as C escapes: NUL alert a backspace  newline carriage-return tab vertical tab v Multi-byte characters are displayed in the area corresponding to the first byte of the character. The remaining bytes are shown as '**'. [d|o|u|x][C|S|I|L|n] Signed decimal (d), octal (o), unsigned decimal (u) or hexadecimal (x). Followed by an optional size specifier, which may be either C (char), S (short), I (int), L (long), or a byte count as a decimal integer. f[F|D|L|n] Floating-point number. Followed by an optional size specifier, which may be either F (float), D (double) or L (long double). -v Write all input data, instead of replacing lines of duplicate values with a '*'. Multiple options that specify output format may be used; the output will contain one line for each format. If no output format is specified, -t oS is assumed. ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of od as described in environ(7). DIAGNOSTICS
The od utility exits 0 on success, and >0 if an error occurs. COMPATIBILITY
The traditional -s option to extract string constants is not supported; consider using strings(1) instead. SEE ALSO
hexdump(1), strings(1) STANDARDS
The od utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
An od command appeared in Version 1 AT&T UNIX. BSD
July 11, 2004 BSD