From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Samuel Subject: Re: sed problem Date: Tue, 09 Mar 2004 00:46:03 -0800 Sender: linux-admin-owner@vger.kernel.org Message-ID: <404D844B.8090805@bcgreen.com> References: <35a8138f03.38f0335a81@euskalnet.net> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <35a8138f03.38f0335a81@euskalnet.net> List-Id: Content-Type: text/plain; charset="iso-8859-1"; format="flowed" To: csoler@euskalnet.net Cc: Jens Knoell , Linux Admin sed 's/|/\n/g' (( I like using single quotes, because you're less likely to get characters like '\' and '$' eaten by the shell )) csoler@euskalnet.net wrote: > Hi Jens, >=20 > ----- Mensaje Original ----- > De: "Jens Knoell" > Fecha: Jueves, Marzo 4, 2004 6:08 pm > Asunto: sed problem >=20 >=20 >>Oke... sed-hell again. >> >>Case: I have a file that has lines separated by pipe chars. I need=20 >>to split >>it back into a line-by-line file. So I tried this (the ^M has been=20 >>enteredby pushing Ctrl+V, Enter): >>echo "This|should|be|on|separate|lines" | sed -e "s/|/^M/g" >> >>The result: >>linesate >> >>I'm sure I'm missing something, but hours of googling didn't get me >>anywhere. Any ideas? >=20 >=20 > I think awk fits better for this task, IMHO of course :-) >=20 > csoler@gudu$ echo "This|should|be|on|separate|lines" | awk -F"|" '{fo= r=20 > (i=3D1; i<=3D NF; i++) print $i}' > This > should > be > on > separate > lines >=20 > I hope this helps you... >=20 > Cheers, > C=E9sar >=20 > - > To unsubscribe from this list: send the line "unsubscribe linux-admin= " in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --=20 Stephen Samuel +1(604)876-0426 samuel@bcgreen.com http://www.bcgreen.com/~samuel/ Powerful committed communication. Transformation touching the jewel within each person and bringing it to light. - To unsubscribe from this list: send the line "unsubscribe linux-admin" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html