Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Awk 基于新行将列转换为行_Awk_Xargs_Perl - Fatal编程技术网

Awk 基于新行将列转换为行

Awk 基于新行将列转换为行,awk,xargs,perl,Awk,Xargs,Perl,我有这样的文件 d e e s k a b c d dee sk abcd dee sk abcd 我只需要像这样转换 d e e s k a b c d dee sk abcd dee sk abcd 为此,我使用了awk和xargs xargs < file|awk '{ gsub (" ", "", $0); print}' xargs

我有这样的文件

d
e
e

s
k

a
b
c
d
dee
sk
abcd
dee
sk
abcd
我只需要像这样转换

d
e
e

s
k

a
b
c
d
dee
sk
abcd
dee
sk
abcd
为此,我使用了awk和xargs

xargs < file|awk '{ gsub (" ", "", $0); print}'
xargs

但是它没有产生预期的结果

请尝试以下内容

$ awk -v RS= -v OFS='' '{$1=$1}1' file

dee
sk
abcd
awk '
!NF && value{
  print value
  value=""
  next
}
NF{
  value=value $0
}
END{
  if(value){
     print value
  }
}' Input_file
使用:

输出
-00
类似于
awk-vrs=