Put one string from one location to another location in a file

Hi Everyone,

I have 1.txt

here
a
b
c' funny"yes";
d
e

The finally output is:

here
a
b
c
d
e' funny"yes";

is any simple way using awk? or others? thanks :confused:

---------- Post updated at 06:40 AM ---------- Previous update was at 05:31 AM ----------

i can do the following to remove ' funny"yes";

awk '{sub(/\x27 funny"yes";/,"");print}' 1.txt > 2.txt

How to add ' funny"yes"; to the last line of 2.txt? :confused:

Thanks

---------- Post updated at 06:53 AM ---------- Previous update was at 06:40 AM ----------

I know le

$varA=`wc -l 2.txt | awk '{print $1}'`;
awk '{if(NR==$varA){print $0"\x27 funny"yes";"}else{print}}' 2.txt > 3.txt

Hope anyone can give a simple method, instead of remove the string, and add the string.
Thanks

awk -F"'" '
BEGIN{while(getline<"2.txt">0)n++}
{if (NR<n)

  {if (NF>1) {a=$2} {print $1}}

else {printf $1"'\''"a}}' 2.txt