Note: You are viewing an old version of this page. View the current version.

Differences between version 2 and previous revision of KnowledgeBase/Scripts/longlines.sh.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 2 Last edited on Sunday, 3 October 2010 3:00:42 by CyberLeo Revert
Older page: version 1 Last edited on Sunday, 3 October 2010 2:57:07 by CyberLeo Revert
@@ -1,10 +1,26 @@
+This will translate a file that consists of backslash-newline broken lines into a file with single long lines.  
+  
+For example:  
+<code>  
+acpi_quirks.h optional acpi \  
+ dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \  
+ compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \  
+ no-obj no-implicit-rule before-depend \  
+ clean "acpi_quirks.h"  
+</code>  
+becomes  
+<code>  
+acpi_quirks.h optional acpi dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" no-obj no-implicit-rule before-depend clean "acpi_quirks.h"  
+</code>  
+  
 <code brush="bash"> 
 expand "${file}" | sed -ne ' 
 /[^\\]$/ { 
 
  s/.*//g 
 
+ s/^\n//g  
  s/\n/ /g 
  s/ */ /g 
 
 

version 2

This will translate a file that consists of backslash-newline broken lines into a file with single long lines.

For example:

acpi_quirks.h                   optional acpi                              \
        dependency      "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \
        compile-with    "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \
        no-obj no-implicit-rule before-depend                              \
        clean           "acpi_quirks.h"

becomes

acpi_quirks.h optional acpi dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" no-obj no-implicit-rule before-depend clean "acpi_quirks.h"
expand "${file}" | sed -ne '
/[^\\]$/ {
  H
  s/.*//g
  x
  s/^\n//g
  s/\n/ /g
  s/  */ /g
  p
}
/\\$/ {
  s/\\$//
  H
}'