a part of replacer MUST use SED

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions a part of replacer MUST use SED
# 1  
Old 05-05-2011
a part of replacer MUST use SED

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
there are 3 files as input and you have to convert them to each other by using SED

Temp1file will be converted to Temp2 as given sample outputs after you use your sed command
then
Temp2 will be converted to Temp3 after you use as given sample output after your use sed command.

2. Relevant commands, code, scripts, algorithms:
Temp1 sample
Code:
@
1
@
2
@
3
This eBook is f
@@:or t
he use of anyone anywhere at no cost and with
@
4
@
5
re-use it under the terms 
@@:of t
he Project Gutenberg License included
@
6
@
7
@
8
@
9
@
10
@
11
@
12
@
13
@
14
@
15
@
16

Temp2 sample
Code:
@1
@2
@3
@
:or t
@4
@5
@
:of t
@6
@7
@8
@9
@10
@11
@12
@13
@14
@15
@16
@17
@18
@19
@20
@21
@22
@23
@24
@25
@26
@27
@28
@29
@30
@31
@32
@33
@34
@35
@36
@37
@38
@39
@40
@41
@42
@
:on t
@43
@
:or t
@44
@45
@46
@47
@48
@
:or t


temp3 sample

Code:
1
2
3
:or t
4
5
:of t
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
:on t



3. The attempts at a solution (include all code and scripts):
first one is something like cat Temp1 | sed -n '/@/ {N;s......


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Bilkent University, Ankara/Turkey, Bahattin Hoca , system programming


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Moderator's Comments:
Mod Comment Using [CODE] instead of [QUOTE] will not replace text with smileys. It's the button on the right side of the quote bubble.

Also, please use complete english words instead of abbreviations

Last edited by pludi; 05-05-2011 at 11:58 AM..
# 2  
Old 05-05-2011
Can you give a plain language pseudo code definition of what changes, file1 to file2 and file2 to file3?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract part of string using sed

Hi, I have the following string and I need to extract the date from it: TextHere,2012/07/11,1 I tried using sed: sed -n 's#^.*\({4}/{2}/{2}\).*$#\1#p' But it doesn't return anything. The following line doesn't even return '2012': sed -n 's/^.*\({4}\).*$/\1/p' I used to use grep -o... (6 Replies)
Discussion started by: Subbeh
6 Replies

2. Shell Programming and Scripting

SED - replace only on part of the string

Hello there, I need some help. I have a file containing this : $ cat file PARM1=(VAL11),PARM2=(VAL21,VAL22,VAL23),PARM3=(VAL31),PARM4=(VAL41,VAL42) and I need to replace all the ',' by '|' but only those which are between brackets. Output would be :... (10 Replies)
Discussion started by: Sephiburp
10 Replies

3. Shell Programming and Scripting

sed command for picking a part of line

Hello Friends I want to use sed command to pick a part of line. FOr example I only need the /home_put1/bidds/myfo part of following line fish://ulavet@rits1.ula.com.tr/home_put1/bidds/myfo How can I do this bu using sed command ? (2 Replies)
Discussion started by: rpf
2 Replies

4. UNIX for Dummies Questions & Answers

sed or awk - removing part of line?

hi all, I am having trouble finding the right string for this - I dont know whether to use awk or sed.. If I have a file with alot of names and phone numbers like this McGowan,Sean 978-934-4000 Kilcoyne,Kathleen 603-555-1212 Club603,The 617-505-1332 Boyle,William 301-444-1221 And... (11 Replies)
Discussion started by: alis
11 Replies

5. Shell Programming and Scripting

Replacing part of a pattern in sed

Hi I have a piece of xml that has a pattern like this <int>159</int><int>30</int> I want to find this pattern but only substitute the second part of the pattern to {rid1}. Is that possible in sed ? Thanks. ---------- Post updated at 12:10 PM ---------- Previous update was at 12:01 PM... (11 Replies)
Discussion started by: vnn
11 Replies

6. Shell Programming and Scripting

change part of a line with sed

Hi gurus, I'd like to change this complete line on a file: BAN_COMMAND="/etc/apf/apf -d $ATTACK_HOST {bfd.$MOD}" to this one: BAN_COMMAND="/sbin/iptables -A INPUT -s $ATTACK_HOST -j DROP" I've tried a lot without any successful . :( thanks in advance Israel. (2 Replies)
Discussion started by: iga3725
2 Replies

7. Shell Programming and Scripting

sed remembering part of pattern using \1 concept

I am using this concept to fetch value of IP address after node= in this line of csv text: a="Measurement:,OutInviteResponseTime,Sessionid=1860700092328051458,node=67.178.40.168,nodeName=abcd,protocol=GK,25523000" echo $a | sed 's/.*node=\(.*\).*/\1/' But this outputs: ... (10 Replies)
Discussion started by: indianjassi
10 Replies

8. Shell Programming and Scripting

Getting sed to work on part of a line

I been trying to get this right. I have trying to get rid of spaces in between the character < and the character >. Everytime I try, sed gets too greedy and do the whole line. Ex. < T AG 1> Hello, how are you doing? <Tag 2> I am doing fine. I want this: <TAG1> Hello, how are you... (6 Replies)
Discussion started by: quixoticking11
6 Replies

9. Shell Programming and Scripting

using sed with xml files part 2

I'm trying to replace a date in an XML file that has the format mm/dd/yyyy. I'm using the Unix date function to set up a variable with the current date but, when I try to replace the value in the XML file, the error message says it cannot be parsed. Here is the command I'm using ... (2 Replies)
Discussion started by: stonemonolith
2 Replies

10. Shell Programming and Scripting

using sed to replace a part of string

Hi, I have files that are named front1.txt to front999.txt. They are all in the same directory. To change "front" to "back", I am doing something like this. for file in *.txt; do new=`echo $file | sed 's/^**/back/g'` mv $file $new done My problem is what if files are named... (6 Replies)
Discussion started by: csejl
6 Replies
Login or Register to Ask a Question