extraction


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting extraction
# 1  
Old 02-23-2011
extraction

I have following input

Code:
@xxxxxx@

I want to extract what's between @....@ that is : xxxx

using SED command
# 2  
Old 02-23-2011
Code:
sed 's/@\([^@]*\)@/\1/g' infile

or just delete the @ if possible
Code:
tr -d '@' < infile

This User Gave Thanks to zaxxon For This Post:
# 3  
Old 02-23-2011
Or:
Code:
sed 's/@//' file

sed 's/\.\(.*\)\./\1/' file

sed 's/@\(.*\)@/\1/' file

awk -F"@" '{print $2}' file

This User Gave Thanks to Franklin52 For This Post:
# 4  
Old 02-23-2011
i dont want to delete '@' i only want to extract the contents between @...@

my input file is this:

Code:
yyyyyyy@xxxxx@yyyyy

I want to extract xxxx from this...
# 5  
Old 02-23-2011
There is several non-deleting solutions up there. Pick one, try it out.
This User Gave Thanks to zaxxon For This Post:
# 6  
Old 02-23-2011
this one worked:
Code:
awk -F"@" '{print $2}' file


Last edited by zaxxon; 02-23-2011 at 08:31 AM.. Reason: code tags
# 7  
Old 02-23-2011
You gotta thank Franklin, not me Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Extraction

Hi, I have three files as below: AA.DAT20110505063903.Z AA.DAT20110405062903.Z AA.DAT20110305061903.Z All the above files are appended with Date and timestamp in compressed format. I need to extract AA.DAT20110505063903.Z(which is the latest file) from one server and uncompress it... (2 Replies)
Discussion started by: pyaranoid
2 Replies

2. Shell Programming and Scripting

Files extraction - any help ?

Hi Friends, i am new to unix,i have a big doubt/help. I have files in folders SER1 and SER2 with naming convention as below file_2010-03-19.txt and so on the file naming format is file_<date>.txt. I would like to copy the files to directory "Landing" I have entries in a log file log.txt... (5 Replies)
Discussion started by: Gopal_Engg
5 Replies

3. UNIX for Dummies Questions & Answers

Extraction of Filename

HI, i would like to ask for your help. how will i be able to extract part of the filename? FILENAME: 000_20071222083029135_evPDSN02.CANCEL i want to get only 000_20071222083029135.CANCEL Thanks and Good Day! :) (2 Replies)
Discussion started by: drco29
2 Replies

4. Shell Programming and Scripting

Extraction of Information

Title : Price : Author : No of books sold France : 40 : John : 30 Persia : 50 : John : 40 Hey guys i am trying to write a code which can help me to find the correct line and then edit the information... (1 Reply)
Discussion started by: gregarion
1 Replies

5. UNIX for Dummies Questions & Answers

Column Extraction

Hello all, I have attached a txt doc with data sorted into columns (it is best to open with "word pad" to maintain the correct format. In the data there are two columns E/N and Ko. I wanted to know how to extract the data and form an excel sheet. Or at least just extract the data. The data is... (4 Replies)
Discussion started by: gingburg
4 Replies

6. Shell Programming and Scripting

Regex extraction

Hello, I need your help to extract text from following: ./sherg_fyd_rur:blkabl="R23.21_BL2008_0122_1" ./serge_a75:rlwual="/main/r23.21=26-Mar-2008.05:00:20UTC@R11.31_BL2008_0325" ./serge_a75:blkabl="R23.21_BL2008_0325" ./sherg_proto_npiv:bkguals="R23.21_BL2008_0302 I80_11.31_LR" I... (11 Replies)
Discussion started by: abdurrouf
11 Replies

7. Shell Programming and Scripting

extraction of last but one char

I need to extract the character before the last "|" in the following lines, which are 'N' and 'U'. The last "|" shouldn't be extracted. Also the no.s of "|" may vary in a line, but I need only the character before the last one. ... (5 Replies)
Discussion started by: hidnana
5 Replies

8. Shell Programming and Scripting

AWK extraction

Hi all, I have a data file from which i would like to extract only certain fields, which are not adjacent to each other. Following is the format of data file (data.txt) that i have, which has about 6 fields delimited by "|" HARRIS|23|IT|PROGRAMMER|CHICAGO|EMP JOHN|35|IT|JAVA|NY|CON... (2 Replies)
Discussion started by: harris2107
2 Replies

9. Shell Programming and Scripting

AWK extraction

Hi all, Can anyone please help me in parsing the following file. Suppose the file is called, example.lst, and has the following content in it. (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) ... (3 Replies)
Discussion started by: harris2107
3 Replies

10. UNIX for Dummies Questions & Answers

help on file extraction

Hello, Im trying to extract a portion of a big file. Using unique pattern /occurrence , (ex. loginname1,logoff and loginname2,logoff ), I like to print the lines that contain the patterns and the lines between them. Also, create a file for every login occurrence. Thanks for everyone's... (1 Reply)
Discussion started by: apalex
1 Replies
Login or Register to Ask a Question