tmp.txt為原文件名,aa.txt為目標文件名 刪除空行,并保存到文件 sed ‘/^/d’ tmp.txt >aa.txt grep -v ‘^’ tmp.txt >aa.txt awk ‘/./’ tmp.txt >aa.txt cat tmp.txt | sed ‘N;s//n//g’>aa.txt cat tmp.txt | sed ‘N;s//n//g’>aa.txt 刪除所有換行并保存到文件 awk ‘{PRintf(“%s”,0)}’ tmp.txt >aa.txt 刪除所有換行不能保存到文件 while read line;do echo -n “line”; done < tmp.txt 刪除所有空格并保存到文件 sed ‘s/[[:space:]]//g’ tmp.txt >aa.txt cat tmp.txt | sed ‘s// //g’>aa.txt 刪除所有換行和空格并保存到文件 awk ‘{printf(“%s”,0)}' tmp.txt | sed 's// //g'1 >aa.txt 當然為了實現刪除所有換行和空格并保存到文件也可以通過上面刪除所有換行和刪除所有空格兩個語句來實現。 原代碼:
- (instancetype)initWithFrame:(CGRect)frame{ if (self=[super initWithFrame:frame ]) { [self addchildV]; } return self;}- (void)addchildV{ [self iputSubPanel];}刪除所有換行和空格并保存到文件的效果
-(instancetype)initWithFrame:(CGRect)frame{if(self=[superinitWithFrame:frame]){[selfaddchildV];}returnself;}-(void)addchildV{[selfiputSubPanel];}新聞熱點
疑難解答