Extraction of Information


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extraction of Information
# 1  
Old 01-11-2010
Extraction of Information

Code:
 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 inside. For the input, the user can only input in the Title, Author and also NewTitle. For example, i will input in France for $title and then John for $author. it will then prompt me to enter new Price which i will enter $60. Basically, it has to search for the correct line using the title and author and then edit the information of price inside that line. I tried using sed.

Code:
sed '/keyword1/{/keyword2/s/old/new/}' filename > newfilename

but this only allows me to search for one keyword. So , i am not able to do the search using both $title and $author. Could you help me on how can i improve this sed command to search for the right row and then edit the right field variable? if i use awk , i am able to use the -F command which will allow me to skip ":" and then the edit the information in the correct variable in $4. but can this be done on sed also?
# 2  
Old 01-11-2010
Hi.

My suggestion to you, really, is to try to learn some stuff by yourself before asking your question here.

This is not something I would usually suggest, but from this question and from your previous posts, you are failing to heed the simplest of advice by not implementing anything you have learnt from previous posts, into your new thinking.

Last edited by Scott; 01-11-2010 at 03:37 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Process Scheduling Information Extraction

I want to extract the process having highest utilization on each processor core and then output its information (PID etc.) to a file. How can I do it by using either top or ps command? Thanks. (1 Reply)
Discussion started by: Vaibhavs1985
1 Replies

2. Shell Programming and Scripting

Sequence extraction

i want to extract specific region of interest from big file. i have only start position, end position and seq id, see my query is: I have file1 is this >GL3482.1 GAACTTGAGATCCGGGGA GCAGTGGATCTCCACCAG CGGCCAGAACTGGTGCAC CTCCAGGCCAGCCTCGTC CTGCGTGTC >GL3550.1... (14 Replies)
Discussion started by: harpreetmanku04
14 Replies

3. Shell Programming and Scripting

String Extraction

I am trying to extract a time from the below string in perl but not able to get the time properly I just want to extract the time from the above line I am using the below syntax x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/ $time = $2 . ':' . $3 . ':' . $4; print $time Can... (1 Reply)
Discussion started by: karan8810
1 Replies

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

5. Shell Programming and Scripting

extraction

I have following input @xxxxxx@ I want to extract what's between @....@ that is : xxxx using SED command (6 Replies)
Discussion started by: xerox
6 Replies

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

7. Programming

extraction from a path

Hi, Can you help me on this two problems? how can i get : from input: /ect/exp/hom/bin ==> output: exp and from input: aex1234 =====>output: ex thanks, (1 Reply)
Discussion started by: yeclota
1 Replies

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

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

10. 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
Login or Register to Ask a Question