# More complex substitutions clear cat ussmall # Simple \( and \) sed 's/^ *\([0-9]\)/\1 \1/' ussmall sed 's/^\(.*\) -- \(..\).*/\2 \1/' ussmall sed 's/\([A-Z][a-z]*\) /"\1 Baby" /' ussmall # Enclose the line in XXX's sed 's/\(.*\)/XXX \1 XXX/' ussmall # Put the first character in quotes sed 's/\(.\)/"\1"/' ussmall # You might think that this would put "Baby" after the first name, but # beware the '*'. sed 's/\([A-Za-z]*\)/"\1 Baby"/' ussmall # Print out score, last name, first name sed 's/[^A-Z]*\([^ ]*\) \([^ ]*\) -- \(..\).*/\3: \2, \1/' ussmall # Print out the name three times sed 's/[^A-Z]*\([A-Za-z ]*\).*/\1\1\1/' ussmall