문제

I am trying to mimic the -i flag in sed when -i throws an error, saying it is not available. Evidently the server I connected to has an ancient version of sed or a version without the -i flag.

How would one mimic the edit in place -i of sed if it were unavailable?

도움이 되었습니까?

해결책

Use ed:

printf ',s/PATTERN/REPLACE/g\nw\nq\n' | ed -s your_file.txt
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top