File: process_in_file

package info (click to toggle)
mcu8051ide 1.4.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 18,820 kB
  • sloc: tcl: 94,956; xml: 2,122; sh: 2,113; asm: 246; ansic: 96; awk: 18; makefile: 5
file content (30 lines) | stat: -rw-r--r-- 736 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /bin/bash

# --------------------------------------------------------------------------
# Auxiliary script for regression testing environment
#
# This script transforms .in files for assembler regression testing into a list
# of command line switches, which are then passed to the assembler. This
# process is done in this way, all comments and empty lines are removed and the
# rest in then concatenated to from a single line. After this all white space
# is shortened.
#
# Software requirements:
# 	- gawk
# --------------------------------------------------------------------------

gawk '
	BEGIN {
		ORS=" "
	}

	{
		sub(/#.*$/, "", $0)
		print($0)
	}
' "${1}" | gawk '
	{
		gsub(/[[:space:]]+/, " ", $0)
		printf("%s", $0)
	}
'