Sponsored Content
Full Discussion: Extract a character
Top Forums UNIX for Advanced & Expert Users Extract a character Post 302132533 by vino on Friday 17th of August 2007 09:36:13 AM
Old 08-17-2007
Code:
echo "string" | sed -n -e "s/^..\(.\).*/\1/p"

or
Code:
t=abcdef
r=echo ${t%${t#???}}
echo ${r#??}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract character + 1

Hi, I would like extract from a file a character or pattern after ( n + 1) a specific pattern (n) . ( i supposed with awk) how could i do ? Thanks in advance. (1 Reply)
Discussion started by: francis_tom
1 Replies

2. Shell Programming and Scripting

How to extract first column with a specific character

Hi All, Below is the sample data of my files: O|A|571000689|D|S|PNH|S|SI sadm|ibscml1x| I|A|571000689|P|S|PNH|S|SI sadm|ibscml1x| O|A|571000689|V|S|PNH|S|SI sadm|ibscml1x| S|C|CAM|D|S|PNH|R|ZOA|2004 bscml1x| ... (3 Replies)
Discussion started by: selamba_warrior
3 Replies

3. Shell Programming and Scripting

Extract the last character of a string

How can I extract the last character of a string (withou knowing how many characters are in that string ! ) (8 Replies)
Discussion started by: annelisa
8 Replies

4. Shell Programming and Scripting

Extract character from string

ps -eaf | grep “oracleTRLV (LOCAL=NO)” | while read ora_proc do echo $ora_proc done I would like to modify the above shell so that if character 13 and 14 equal "12" to do something. Sorry I'm new to shell:( (14 Replies)
Discussion started by: NicoMan
14 Replies

5. Shell Programming and Scripting

Extract a character specifying position

hi , i am having a file Full_ARTMAS_20110510152425.xml in my local directory. i wanted to extract the character at the 35143546 th position at line 1 of this file.Can any body help me how to do it??? regards Anjali (2 Replies)
Discussion started by: angel12345
2 Replies

6. Shell Programming and Scripting

Extract text between two character positions

Greetings. I need to extract text between two character positions, e.g: all text between character 4921 and 6534. The text blocks are FASTA-format sequence of whole chromosomes, so basically a million A, T, G, C, combinations. E.g: >Chr_1 ACCTGTTCAACTCTCAGGACTCTCAGGTCAACTCTCAG... (3 Replies)
Discussion started by: Twinklefingers
3 Replies

7. Shell Programming and Scripting

Extract First character in Second column

Hi, I need to extract the first character of second column of my file. If the condition matches, then I need to print the 2nd and 3rd column as my output I tried below mentioned query but it was not working awk -F'|' '$2~/^5/' Sgn_group.txt File Name : Sgn_group.txt country... (2 Replies)
Discussion started by: suresh_target
2 Replies

8. Shell Programming and Scripting

How to use substr to extract character between two semicolon?

Dear folks Hello I have a data set which one of the column of this data set are string and I want to extract numbers which is between two ":". However, I know the substr command which will do this operation but my problem is the numbers between two ":" have different digits. this will make my... (11 Replies)
Discussion started by: sajmar
11 Replies

9. Shell Programming and Scripting

Extract all first numeric character from a string

Hello, I have a file of strings a below:- 4358RYFHD9845 28/COC/UYF984 9834URD 98HJDU I need to extract all the first numeric character of every sting as follows:- 4358 28 9834 thanks to suggest ASAP Regards, Jasi Use code tags, thanks. (7 Replies)
Discussion started by: jassi10781
7 Replies

10. Shell Programming and Scripting

How to extract every 6-th character in a line?

Hi, I have a file consist of 25000 lines and each line has 2 columns 1 column with 6 numeric characters and 2nd one with 45000 numeric characters (not delimited). I want to take every 7th character form the 2nd column, keeping the first column. I made it in several steps but it run for 7 hours to... (7 Replies)
Discussion started by: SANDO
7 Replies
iso2022(5)							File Formats Manual							iso2022(5)

NAME
iso2022, iso-2022, ISO-2022 - A character encoding mechanism standardized by the International Standards Organization (ISO) DESCRIPTION
The ISO-2022 standard defines a mechanism for handling single-byte and multibyte characters. The standard specifies four classes of charac- ter sets: The 94-charset class, which contains character sets with 94 positions (single-byte characters). Examples are the ASCII and JIS X0201 character sets. The 96-charset class, which contains character sets with 96 positions (single-byte characters). Examples are the ISO Latin series of character sets. The 94x94-charset class, which contains character sets with 94x94 positions (2-byte characters). Examples are the GB 2312 and the CNS 11643 character sets. The 96x96-charset class, which contains character sets with 96x96 positions (2-byte characters). In the ISO-2022 standard, four registers, called G0, G1, G2 and G3, are used to reference a character set. Before a character set can be used, the character set must be assigned, or designated, to one of these registers. The designation of a character set is done by using an escape sequence in the following format: ESC [I] F In this format: Is an intermediate character that is used to designate a character set to one of the registers (G0, G1, G2, oR G3). Is a unique final character of a particular character set. The designation of a character set, whose final character is F, to different registers is as follows: Designates a multibyte character set (94x94 or 96x96) to G0. Designates a character set in the 94-charset class to G0. Designates a character set in the 94-charset class to G1. Designates a character set in the 94-charset class to G2. Designates a character set in the 94-charset class to G3. Designates a character set in the 96-charset class to G1. Designates a character set in the 96-charset class to G2. Designates a character set in the 96-charset class to G3. SEE ALSO
Commands: locale(1) Others: ascii(5), i18n_intro(5), iso2022jp(5), l10n_intro(5) iso2022(5)
All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy