I'm trying to write a basic sed script, I want to append to lines that start with SSID:
. Here is what I'm trying now:
#!/bin/sed -f
/^SSID:/ s/*/},\n{/
With the following input:
SSID: '2KLIC Guests'
BSSID: F0:9F:C2:21:03:BA
MODE: Infrastructure
FREQ: 2437 MHz
RATE: 16 MB/s
SIGNAL: 100
SECURITY: WPA2
ACTIVE: yes
SSID: 'CBMS-2.4GHz'
BSSID: 10:BE:F5:25:FD:60
MODE: Infrastructure
FREQ: 2412 MHz
RATE: 16 MB/s
SIGNAL: 0
SECURITY: WPA WPA2
ACTIVE: no
SSID: 'CIK1000M_AC2.4G_3714'
BSSID: D0:60:8C:03:DB:B4
MODE: Infrastructure
FREQ: 2422 MHz
RATE: 16 MB/s
SIGNAL: 0
SECURITY: WPA2
ACTIVE: no
I also tried escaping the :
. Can someone explain what I'm doing wrong here?
SSID
?},\n{
like the end of a json object @Jesse_b*
as a pattern to be replaced instead of.*
. This is not globbing, but regular expression! So, with/^SSID:/ s/.*/},\n{/
it would work.