Using AWK or Sed, how can I remove carriage returns and line feeds from the start of a file before first txt.
Before
TOP OF FILE - Carriage returns and line feeds before txt
<?xml version="1.0" encoding="UTF-8"?>
<fredBaa version="1.2" properties="2.8" Baa="2.13 r1665067">
<hashTree>...
After
TOP OF FILE - No Carriage returns and line feeds before txt
<?xml version="1.0" encoding="UTF-8"?>
<fredBaa version="1.2" properties="2.8" Baa="2.13 r1665067">
<hashTree>...
you can try this:
awk '/</{a=1}a' file
or to remove all leading lines until the one that has a non-blank character:
awk '/[^[:space:]]/{a=1}a' file
所有你需要的是:
awk 'NF{f=1}f' file
这对你有用吗?
sed '0,/./{/./!d}' file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.