KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
my question seems to be general, but i can't find any answers. In sed command, how can you replace the substitution pattern by a value returned by a simple bash function. For instance, I created the following function : function parseDates(){ #Some process here with $1 (the pattern found) return "dateParsed; } and the folowing sed command : myCatFile=`sed -e "s/[0-3][0-9]\/[0-1][0-9]\/[0-9][0-9]/& parseDates &\}/p" myfile` I found that the caracter '&' represents the current pattern found, i'd like it to be passed to my bash function and the whole pattern to be substituted by the pattern found +dateParsed. Does anybody have an idea ? Thanks
Tags (comma-separated)
Save Edits
Cancel