我无法弄清楚如何使用sed(sed)或awk(gawk)用新行替换文本中的\n
。例如,我想替换sed或awk命令
你好世界\ n我来自火星\ n
作者
你好世界
我来自火星
我无法弄清楚如何使用sed(sed)或awk(gawk)用新行替换文本中的\n
。例如,我想替换sed或awk命令
你好世界\ n我来自火星\ n
作者
你好世界
我来自火星
我在https://unix.stackexchange.com/questions/140763/replace-n-by-a-newline-in-sed-portably找到了答案:
awk '{gsub("\\\\n","\n")};1' filename
,
使用GNU x1 = np.linspace(df[F1].min(),df[F1].max(),len(df[F1].unique()))
y1 = np.linspace(df[F2].min(),df[F2].max(),len(df[F2].unique()))
x2,y2 = np.meshgrid(x1,y1)
z2 = griddata((df[F1],df[F2]),df[P1],(x2,y2),method='cubic')
surf = ax.plot_surface(x2,y2,z2,rstride=1,cstride=1,alpha=0.1)
cset = ax.contourf(x2,zdir='z',offset=48,cmap=cm.coolwarm)
:
sed
使用bash参数扩展:
sed 's/\\n/\n/g' file