How to access a file with su and search a pattern
su - root exec cat /home/root/file1.txt | grep pattern search
Getting the below error when try to find patterns
**script: write :no space left on device **
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
su - root grep pattern /home/root/file1.txt will do it. "no space left on device" is related to some other part of your script which tries to write data to an already full storage device.