Sponsored Content
Full Discussion: Copy pattern inside the file
Top Forums UNIX for Beginners Questions & Answers Copy pattern inside the file Post 303014958 by arunkumar_mca on Saturday 24th of March 2018 07:44:18 AM
Old 03-24-2018
It worked. But it replaced the order. If you look below the second position is the order it is like 1,2,3,4. After doing the replace in command it replaced the order

Input file:

Code:
11047;7;292;;;;;;;38.68;;;;;;;;;;;;;;;;;;;;;;;;;;
11047;15;292;;;;;;;273.71;;;;;;;;;;;;;;;;;;;;;;;;;;
11047;16;292;;;;;;;273.71;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;1;292;;;;;;;1137724.23;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;2;292;;;;;;;500197.31;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;3;292;;;;;;;51221.56;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;4;292;;;;;;;11.39;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;5;292;;;;;;;296541.27;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;6;292;;;;;;;58789.22;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;7;292;;;;;;;93633.87;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;8;292;;;;;;;300853.43;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;11;292;;;;;;;5.94;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;12;292;;;;;;;209402.79;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;13;292;;;;;;;91444.70;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;15;292;;;;;;;336673.49;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;16;292;;;;;;;11939.95;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;17;292;;;;;;;35419.41;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;18;292;;;;;;;35494.11;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;19;292;;;;;;;26864.34;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;20;292;;;;;;;65904.01;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;21;292;;;;;;;110799.84;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;23;292;;;;;;;45340.23;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;24;292;;;;;;;4911.60;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;1;292;;;;;;;216356.16;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;2;292;;;;;;;94187.78;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;3;292;;;;;;;20145.44;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;5;292;;;;;;;66421.60;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;6;292;;;;;;;55.19;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;7;292;;;;;;;7565.55;;;;;;;;;;;;;;;;;;;;;;;;;;
22002;8;292;;;;;;;78129.97;;;;;;;;;;;;;;;;;;;;;;;;;;

Output file
Code:
11047;5;292;;;;;;;23.97;;;;;;;;;;;;;;;;;;;;;;;;;;
11047;6;292;;;;;;;5.99;;;;;;;;;;;;;;;;;;;;;;;;;;
11047;7;292;;;;;;;38.68;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;11;292;;;;;;;5.94;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;12;292;;;;;;;209402.79;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;13;292;;;;;;;91444.70;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;15;292;;;;;;;336673.49;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;16;292;;;;;;;11939.95;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;17;292;;;;;;;35419.41;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;18;292;;;;;;;35494.11;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;19;292;;;;;;;26864.34;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;1;292;;;;;;;1137724.23;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;20;292;;;;;;;65904.01;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;21;292;;;;;;;110799.84;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;23;292;;;;;;;45340.23;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;24;292;;;;;;;4911.60;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;2;292;;;;;;;500197.31;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;3;292;;;;;;;51221.56;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;4;292;;;;;;;11.39;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;5;292;;;;;;;296541.27;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;6;292;;;;;;;58789.22;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;7;292;;;;;;;93633.87;;;;;;;;;;;;;;;;;;;;;;;;;;
11048;8;292;;;;;;;300853.43;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;11;292;;;;;;;5.94;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;12;292;;;;;;;209402.79;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;13;292;;;;;;;91444.70;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;15;292;;;;;;;336673.49;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;16;292;;;;;;;11939.95;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;17;292;;;;;;;35419.41;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;18;292;;;;;;;35494.11;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;19;292;;;;;;;26864.34;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;1;292;;;;;;;1137724.23;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;20;292;;;;;;;65904.01;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;21;292;;;;;;;110799.84;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;23;292;;;;;;;45340.23;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;24;292;;;;;;;4911.60;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;2;292;;;;;;;500197.31;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;3;292;;;;;;;51221.56;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;4;292;;;;;;;11.39;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;5;292;;;;;;;296541.27;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;6;292;;;;;;;58789.22;;;;;;;;;;;;;;;;;;;;;;;;;;
22001;7;292;;;;;;;93633.87;;;;;;;;;;;;;;;;;;;;;;;;;;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it? using grep command.. Bit urgent.. pls..help me (2 Replies)
Discussion started by: senraj01
2 Replies

2. Shell Programming and Scripting

Need help in sed command ( Replacing a pattern inside a file with a variable value )

Hello, The following sed command is giving error sed: -e expression #1, char 13: unknown option to `s' The sed command is echo "//-----" | sed "s/\/\/---*/$parChk/g" where parChk="//---ee-" How can i print the variable value from sed command ? And is it possible to replace a... (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Shell Programming and Scripting

pattern replace inside text file using sed

Hi, I have a situation where I want to replace some occurrences of ".jsp" into ".html" inside a text file. For Example: If a pattern found like <a href="http://www.mysite.com/mypage.jsp"> it should be retained. But if a pattern found like <a href="../mypage.jsp"> it should be changed to... (4 Replies)
Discussion started by: meharo
4 Replies

4. Shell Programming and Scripting

how to find the pattern inside the file and replace it

hello everybody, I have a group of file eg- sample1 sample2 sample3 sample4 each file contain this :- cat sample1 SEQ_NUM,1,UPESI1 My requirement is to change the value-UPESI1 to UPE10 in file which contain this pattern -UPESI1. any help is appreciated. (2 Replies)
Discussion started by: abhigrkist
2 Replies

5. Homework & Coursework Questions

copy files inside a text file

Hi Guys , I am new to this and Hi to all ,Need your help I am trying to copy Files which are inside file.txt The files inside file.txt are inthe below order file1.log file2.log file3.log ....... I want to copy these files to an output Directory , Please help (1 Reply)
Discussion started by: hc17972
1 Replies

6. Homework & Coursework Questions

copy files inside a text file

Hi Guys , I am new to this and Hi to all ,Need your help I am trying to copy Files which are inside file.txt The files inside file.txt are inthe below order file1.log file2.log file3.log ....... I want to copy these files to an output Directory , Please help (1 Reply)
Discussion started by: hc17972
1 Replies

7. Shell Programming and Scripting

Help with matching pattern inside a file

I have a huge file that has roughly 30304 lines. I need to extract specific info from that file. For example, Box 1 > *aaaaaaaajjjj* > hbbvjvj > jdnnfddllll > *dgdfhfekwjh* Box 2 > *aaaaaaa'aj'jjj* > dse hkjuejef bfdw > dyeee > dsewq > *dgdfhfekwjh* >feweiuei Box 3 > *aaaa"aaaaj"jjj* >... (25 Replies)
Discussion started by: Ernst
25 Replies

8. Shell Programming and Scripting

Finding the pattern and replacing the pattern inside the file

i have little challenge, help me out.i have a file where i have a value declared and and i have to replace the value when called. for example i have the value for abc and ccc. now i have to substitute the value of value abc and ccc in the place of them. Input File: go to &abc=ddd; if... (16 Replies)
Discussion started by: saaisiva
16 Replies

9. Shell Programming and Scripting

Copy and paste text inside a xml file

I have a really big XML file. I need copy the value of one tag inside another one tag. I try to publish one example. <channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1">Rai 1</channel> <channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1 +2HD">Rai 1... (6 Replies)
Discussion started by: Tapiocapioca
6 Replies

10. UNIX for Beginners Questions & Answers

Search a string inside a pattern matched block of a file

How to grep for searching a string within a begin and end pattern of a file. Sent from my Redmi 3S using Tapatalk (8 Replies)
Discussion started by: Baishali
8 Replies
All times are GMT -4. The time now is 12:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy