I wish to swap or transpose pairs of lines according to their line-numbers (e.g., switching the positions of lines 10 and 15) in multiple text files using a UNIX tool such a
if, you want swap two lines, to create script "swap.sh"
#!/bin/sh sed -n "1,$((${2}-1))p" "$1" sed -n "${3}p" "$1" sed -n "$((${2}+1)),$((${3}-1))p" "$1" sed -n "${2}p" "$1" sed -n "$((${3}+1)),\$p" "$1"
next
sh swap.sh infile_name 14 26 > outfile_name