cat only_arm.urdf | python -c "import sys,re;sys.stdout.write(re.sub('<gazebo(.|\n)*?<\/gazebo>*', '', sys.stdin.read()))" > only_arm.urdf.nogazebo This was to delete gazebo tags in an URDF file in a single commandline with things that (usually) come with the base system.