That worked! You are a master!!
---------- Post updated at 10:21 PM ---------- Previous update was at 07:33 PM ----------
The next problem I'm getting now is it seems to be operating across not exact strings.
so what this is doing is replacing a series of lines names "Read#" with lines "[filename]"
Quote:
name Read31
name Read10
name Read42
name Read43
name Read2
name Read4
name Read22
name Read23
name Read24
name Read25
name Read26
name Dot59
name Read27
name Read28
name Read29
name Read30
name Read48
name Read32
name Read14
name Read15
name Read7
name Read8
name Read13
name Dot27
name Read11
name Read9
name Read17
name Read20
name Read49
name Read12
name Read16
name Read18
name Read5
name Read6
name Read21
name Read33
name Read3
name Read37
name Read38
name Read36
name Read1
name Read34
name Read35
name Read39
name Read19
name Read41
name Read45
name Read40
name Read44
name Read47
name Read46
the problem is, the targets are getting replaced in bulk and ruining the entire script. So rather than replace Read1 with [file in applicable array slot] it is replacing Read1. Read10, Read11 etc.
Quote:
name Read31
name 058_PA_007_CMP_V0024_0000000_L0
name Read42
name Read43
name Read2
name Read4
name Read22
name Read23
name Read24
name Read25
name Read26
name Dot59
name Read27
name Read28
name Read29
name Read30
name Read48
name Read32
name 058_PA_007_CMP_V0024_0000000_L4
name 058_PA_007_CMP_V0024_0000000_L5
name Read7
name Read8
name 058_PA_007_CMP_V0024_0000000_L3
name Dot27
name 058_PA_007_CMP_V0024_0000000_L1
name Read9
name 058_PA_007_CMP_V0024_0000000_L7
name Read20
name Read49
name 058_PA_007_CMP_V0024_0000000_L2
name 058_PA_007_CMP_V0024_0000000_L6
name 058_PA_007_CMP_V0024_0000000_L8
name Read5
name Read6
name Read21
name Read33
name Read3
name Read37
name Read38
name Read36
name 058_PA_007_CMP_V0024_0000000_L
name Read34
name Read35
name Read39
name 058_PA_007_CMP_V0024_0000000_L9
name Read41
name Read45
name Read40
name Read44
name Read47
name Read46
The only one I want to change in that instance is
Quote:
name 058_PA_007_CMP_V0024_0000000_L
the rest are just residual from it replacing all instances instead of the exact match.
I have tried
Quote:
sed -i.bak 's/'\<${ARRAY1[$i]}\>'/'${ARRAY2[$i]}''/'g' ${FILE}.txt
but that results in nothing changing for some reason. If anyone has a way to get this to work it would be a great help! Thanks!
---------- Post updated at 11:37 PM ---------- Previous update was at 10:21 PM ----------
is it possible to use a carriage return \n as a search string? like
Quote:
sed -i.bak 's/${ARRAY1[$i]}\n/'${ARRAY2[$i]}''/'g' ${FILE}.txt
or something like that?
---------- Post updated 08-14-12 at 09:35 AM ---------- Previous update was 08-13-12 at 11:37 PM ----------
Quote:
sed s/${ARRAY1[$i]}$/${ARRAY2[$i]}/ ${FILE}.txt
Looks like that should work, I will try when I get in to work today.
##edit, that was it!
---------- Post updated at 12:30 PM ---------- Previous update was at 09:35 AM ----------