On Sun, 2008-06-01 at 17:16 -0700, Craig White wrote:
> I need to remove a frequent line in one of my files...
>
> The line looks like this...
>
>
> cat rights_roles.yaml | \
> awk '{if ($1=="\-\-\- \!ruby\/object\:RightsRoles"){print ""} \
> else {print $0}}' > rights_roles.yml
----
oops - sent too soon by accident. The line looks like this...
--- !ruby\/object\:RightsRoles
and I want to remove the entire line with line feed (otherwise I'd be
using sed). The above awk command doesn't work.
grep will work with this...
grep '\-\-\- \!ruby\/object\:RightsRoles' rights_roles.yaml
Bonus question...ideally, I would like to add this to a nested set of
awk conditionals...conceptually like this...
tac rights_roles.txt | awk '{if (COND-1){print "RESULT-1"}; \
else {if (COND-2) {print "RESULT-2"}; \
else {if ($1=="\-\-\- \!ruby\/object\:RightsRoles") \
{print NOTHING};} \
else {print $0}}' | tac - > rights_roles.yaml
but nesting if/else in awk really is confusing and I could live with it
in separate commands if I could get the first one to work.
Craig
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss