All pastes #939962 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-12 18:10 UTC
rendered paste body
##############
dean_line_one
##############
MaxRetries: 0
Context: page_dean_one
Extensions: s
Priority: 1


###################################################################
bash script (deletes everything and just puts in the context line.  isn't a find and replace
####################################################################
for file in *; do echo Context: "page_${file%%_*}_${file#*_*_}" > "$file"; done

###################################################
sed command to get filename in right order.  still need to figure out how to do a find and replace
######################################################

for i in *; do sed 's/\(.*\)_.*_\(.*\)/page_\1_\2/' <<< $i; done


################
notes
################
I have a bunch of different files, such as (dean_line_one, bob_line_fifty, etc) that all contain the same information as dean_line_one.  What I want to do is go through each file and where it says "Context: page_dean_one" I want it to look at the file and replace "page_dean_one" with info from the filename.  for example if the file was called james_line_fifty I want it to go in the file find the context line and where it says "page_dean_one I want it to say page_james_fifty.