10 Topics

Member Avatar for
Member Avatar for AndrisP

How i can `sed` save pattern matches to variables and do something with it? eg $ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/' output "4 3 2" but I want to pass variables to function eg do_something() { echo $1 echo $2 echo $3 # ..... # ..... } string="string_4.3.2" …

Member Avatar for AndrisP
0
821
Member Avatar for lewashby

`grep -v "#EXTINF:" All.m3u | sed 's#../##'g` I'm using the line above to try and make the playlists that I export from Banshee compatible with my digital music player. When I run the sed portion of this script I'm trying to remove the portion of the path up to where …

Member Avatar for rubberman
0
335
Member Avatar for chris.kelley.5015

Hello, I am trying to create a script that will compare one word at a time from one file to every word in a second file. I know how to design nested for loops to read the first entry in file1 and compare it to every entry in file2, so …

Member Avatar for Watael
0
262
Member Avatar for axn

sed - need to replace only the chars or symbol after 1st and 2nd dot(.) with "int1" and "int2" respectively. Here is what I have tried but it replaces the strings in other lines. End result should look like - A.**int1**.**int2**.any.string.here sed -e 's/*/int1/' -e 's/*/int2/' -e 's/ABCD/int1/' filename A.*.*.ABCD.DEFG.HIJK …

Member Avatar for chris.kelley.5015
0
168
Member Avatar for PyroPlasm

I have a shell script that is outputting from a database. What is coming from the DB is this: ----------- 50 (1 rows affected) The issue that I have is there is an if statement in my script that looks at the first line and reads the number there. Unfortunately …

Member Avatar for histrungalot
0
165
Member Avatar for koricha

can some body expaly me this command [CODE]sed -e 's/<[^>]*>//g' test > test.t [/CODE] thank you

Member Avatar for koricha
0
168
Member Avatar for msrikanth

Hi Everyone, I need a replace a string (ex : this) with the string (ex : that) in each line of a file (sample.txt) using a C Shell Script and I am not allowed to use sed,awk and replace command in the unix , So i tried to use tr …

Member Avatar for histrungalot
0
7K
Member Avatar for tap3ah

I'm trying to write a bash script that converts html file into latex file by processing each line with sed. I'm stuck with following issue: I need to replace [ICODE]<a name="[I]something[/I]">[/ICODE] with [ICODE]\index{[I]something_else[/I]}[/ICODE]. I have an associative array with key-value pairs like this: [ICODE]"[I]something[/I]" => "[I]something_else[/I]"[/ICODE]. However, there are 2 …

Member Avatar for tap3ah
0
188
Member Avatar for terabyte

y/A-Za-z/N-ZA-Mn-za-m/; it is a rot13 script but I don't undestand how it works, what is the y// operator for

Member Avatar for masijade
0
113
Member Avatar for kristo5747

Greetings. I am using SED to cleanup files that are laid out like so: [icode] ReceiverID=028936004663 SerialNumber=WD-WCAV95708405 Currenttemp=44C PowerOnHours=3663h ReceiverID=028923894902 SerialNumber=WD-WCAV9A766701 Currenttemp=49C PowerOnHours=2215h [/icode] My boss wants files like this one to be tab ("\t") delimited like so [icode] ReceiverID=...(tab)SerialNumber=...(tab)Currenttemp=...(tab)PowerOnHours=...(newline) ReceiverID=...(tab)SerialNumber=...(tab)Currenttemp=...(tab)PowerOnHours=...(newline)... [/icode] 1) first, I added a newline to mark …

Member Avatar for kristo5747
0
146

The End.