Sponsored Content
Top Forums Shell Programming and Scripting Detect blank spaces in a CSV file Post 302982786 by Don Cragun on Tuesday 4th of October 2016 01:35:04 AM
Old 10-04-2016
With any POSIX conforming shell, you could also do this entirely in the shell:
Code:
#!/bin/ksh
while IFS= read -r line
do	printf 'Processing %s\n' "$line"
	set -- $line
	ip=$1
	tm=$2
	shift 2
	SSID=
	while [ $# -gt 1 ]
	do	SSID=${SSID}_$1
		shift
	done
	SSID=${SSID#_}
	printf '%s %s %s %s\n' "$ip" "$tm" "$SSID" "$1"
done < file.csv

which, if file.csv contains:
Code:
18:70:9f:e3:80:aa 10:11:15 MyNetwork 2437
18:70:9f:e3:80:aa 10:11:15 My Wi-Fi Network 2438
18:70:9f:e3:80:aa 10:11:15 2439

produces the output:
Code:
Processing 18:70:9f:e3:80:aa 10:11:15 MyNetwork 2437
18:70:9f:e3:80:aa 10:11:15 MyNetwork 2437
Processing 18:70:9f:e3:80:aa 10:11:15 My Wi-Fi Network 2438
18:70:9f:e3:80:aa 10:11:15 My_Wi-Fi_Network 2438
Processing 18:70:9f:e3:80:aa 10:11:15 2439
18:70:9f:e3:80:aa 10:11:15  2439

These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To remove Continous blank spaces from a file in UNIX

All... I want to remove blank spaces in file . I just leraned that we can use " cat <Input filename> | tr -s ‘ ‘ > <Target file name> " i also know with SED we can replace a blank space by other character by sed s/ /*/g filename. Please let me know how can i do that by... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

2. Shell Programming and Scripting

Removing blank spaces from a file?

Guys, I need some help... how can I remove the blank spaces between the lines below? (between the date and the hour fields) 21/05/07 00:05:00 99 21/05/07 00:10:01 99 21/05/07 00:15:00 99 21/05/07 00:20:00 99 21/05/07 00:25:00 99 I want to make the file... (4 Replies)
Discussion started by: dfs
4 Replies

3. Shell Programming and Scripting

how to remove blank spaces of a file with awk??

hello how to remove blank spaces of a file with awk?? i´m trying awk '{gsub(" ","",$0); print $0;}' filename.txt but it answers syntax error near line first of all i did this for download from netbackup database jobs privilege bpdbjobs -report -M sv88 -gdm -header |cut -c-1024... (4 Replies)
Discussion started by: pabloli150
4 Replies

4. Shell Programming and Scripting

Remove blank spaces in a text file...

Hi, I have this problem that there are blank spaces in my text file... i want to remove them line 1 line 2 line 3 I want to remove the space between line 2 and line 3... I tried sed... it work but it prints the whole text file at the command prompt which i dont want.... sde i tried was... (4 Replies)
Discussion started by: bhagya2340
4 Replies

5. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

6. Shell Programming and Scripting

Blank spaces missing in the file

I have a file which has blank spaces($) and the blank spaces at the end of the file are not coming up while cutting the files.. please find the following file, desired output.. file1: 001_AHaris$$$$$020$$$$$$$$$ 001_ATony$$$$$$030$$$$$$$$$ 002_AChris$$$$$090$$$$$$$$$... (5 Replies)
Discussion started by: techmoris
5 Replies

7. Shell Programming and Scripting

how to remove blank spaces in file

hi i have a file which store some data.the contents of my file is data1:data2 data3:data4 i have a script which read this file correct="$(cat /root/sh | cut -d: -f1)" i used this syntax..please help me which syntax is used to remove blank spaces..then how to read this file.. (1 Reply)
Discussion started by: shubhig15
1 Replies

8. Shell Programming and Scripting

Help with removal of blank spaces in a file

Hello.. I have a text file. I want to remove all the blank spaces(except tab) from the file.. I tried using sed command as shown below sed 's/ //g' file1 But the problem with the above command is that it also eliminates 'tab' which is between the columns.. For example if the contents... (7 Replies)
Discussion started by: abk07
7 Replies

9. Shell Programming and Scripting

How to remove all blank spaces in a file

I have a file which contains data such as that shown below. How do i remove all the blcnak spaces, before, during and at the end of each line in one command? 300015, 58.0823212, 230.424728 300016, 58.2276459, 229.141602 300017, 58.7590027, 226.960846 ... (9 Replies)
Discussion started by: carlr
9 Replies

10. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

Hi Gurus, Somebody can say me how to delete blank spaces and blank lines in a file unix, please. Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies
AX25D.CONF(5)						     Linux Programmer's Manual						     AX25D.CONF(5)

NAME
ax25d.conf - ax25d configuration file. DESCRIPTION
Ax25d.conf controls the functioning of ax25d. Its purpose is to specify on which ports to listen on, which applications are available, and to whom they are available to. The configuration file is common to both AX.25, NET/ROM and Rose and their is similarity between the two parts of the file. The general layout for an entry for a given port is as follows: interface control callsign entry 1 . . callsign entry n The interface control line determines which port and callsigns apply to the following callsign entry lines, until the next interface con- trol is read. There are four different variants of the interface control line: 1. [AX.25 Port Name] 2. [Callsign VIA AX.25 Port Name] 3. <NET/ROM Port Name> 4. {Callsign VIA Rose Port Name} Version 1 allows the following callsign entry lines to listen on the AX.25 port specified by the AX.25 port name using the default callsign of that AX.25 port. Version 2 allows the following callsign entry lines to listen on the AX.25 port specified by the AX.25 port name using the callsign speci- fied instead of the default callsign of that AX.25 port. Specifying a * for the AX.25 port name allows the following callsign entries to be valid for all the operating AX.25 ports using the callsign specified. VIA can be abbreviated to just V. If the callsign has an asterisk appended to it then the system will be listening on the port with the callsign, but as a pseudo-digipeater instead of being the normal des- tination callsign. Version 3 allows the following callsign entry lines to listen on the NET/ROM port specified by the NET/ROM port name using the default callsign of that NET/ROM port. Version 4 allows the following callsign entry lines to listen on the Rose port using the specified Rose port name using the callsign speci- fied as the service access point (SAP). A * may be specified for a callsign to allow matching to any incoming Call Requests with any SAP. The callsign entry lines have a similar layout for both AX.25, NET/ROM and Rose, the layout is: peer window t1 t2 t3 idle n2 mode uid exec args... All values must be entered for all entries even when they are not used (ie window for NET/ROM, just enter a * instead), The meanings of each of the fields is given below. All timings apart from the idle value are given in seconds, the idle values is given in minutes. peer This specifies the callsign of the remote end of the connection that should have the following parameters and executable set up for them. The syntax of the peer argument is explained below. window This sets the the value of the window size, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. This entry is used by AX.25 but not by NET/ROM or Rose. t1 This sets the the value of the T1 timer, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. This entry is used by both AX.25 and NET/ROM but not by Rose. t2 This sets the the value of the T2 timer, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. This entry is used by both AX.25 and NET/ROM but not by Rose. t3 This sets the the value of the T3 timer, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. This entry is used by AX.25 but not by NET/ROM or Rose. idle This sets the the value of the idle timer, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. n2 This sets the the value of the N2 counter, if a value of * is entered in this field then the default value for the port is taken from the "parameters" entry (see below) or lacking such an entry, the kernel default value is used. This entry is used by both AX.25 and NET/ROM but not by Rose. mode This is a set of flags that control the various properties associated with the incoming connection. The flags are single letters, may be in either upper or lower case, and there may not be any spaces between them. If no flags are to be speci- fied either a 0, - or a * must be entered instead. The valid mode flag letters are: D Do not allow connections that have passed via any digipeaters. AX.25 only. L Do not allow this station to connect, they are Locked out. N Check that the NET/ROM neighbour is allowed, currently unused. Q Do not make an entry into the log file for this connection. V Validate the callsign of the incoming connection, currently unused. uid This is the userid that the following command should run under when executing. exec This is the executable that should be executed when an incoming connection matches the criteria of both the interface con- trol and the callsign entry . args... These are the optional arguments that are passed to the executable. All of the arguments are passed literally apart from the following: %d The name of the port that the connection is on. %U The username (callsign) of the remote station in upper case without the SSID. %u The username (callsign) of the remote station in lower case without the SSID. %S The username (callsign) of the remote station in upper case with the SSID. %s The username (callsign) of the remote station in lower case with the SSID. %P The nodename of the remote station in upper case without the SSID. This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead. %p The nodename of the remote station in lower case without the SSID. This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead. %R The nodename of the remote station in upper case with the SSID. This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead. %r The nodename of the remote station in lower case with the SSID. This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead. %% A %. The peer argument is dependant upon whether AX.25, NET/ROM or Rose is being used. There are five formats of this argument: 1. default 2. parameters 3. callsign 4. callsign@node 5. @node The first version is used by AX.25, NET/ROM and Rose to specify that all callsigns on a given port are to be matched. The default line is usually the last of the callsign entry lines, so that more specific entries may have the chance to be matched first. The second version is not a callsign entry that is used by any incoming connections. It is a means to specify default values for parameters such as Window, T1, T2, T3, Idle and N2. It is used for both AX.25, NET/ROM and Rose. The third version is used by both AX.25, NET/ROM and Rose to specify the callsign of the remote station to match the callsign entry line. If no SSID is specified then the callsign will be matched with any that has the same callsign and any SSID. Specifying an SSID causes the callsign to be matched exactly. In the case of NET/ROM and Rose this entry does not specify which node the originating callsign comes from. The fourth version is used by NET/ROM and Rose to specify the callsign of the remote station and the remote node to match the callsign entry line. If no SSID is specified in the callsign section then the callsign will be matched with any that has the same callsign and any SSID. Specifying an SSID causes the callsign to be matched exactly. The fifth version is used by NET/ROM and Rose to specify only the address of the remote node to match the callsign entry line. This entry will mean that all remote users at the given node will match the entry. Comments may be embedded in the configuration file by placing a # in the first column. ax25d can now honour AX.25 TCP/IP mode-VC connections in a special way. Therefore, a new port specific option "parameters_extAX25" is available, with the following options, which are seperated by space. parameters_extAX25 VC-debug VC-reject-login|VC-wait-login|VC-login-ok VC-disc-on-linkfailure-msg, VC-send-failure-msg, VC-log-connections Recommended settings in ax25d.conf: parameters_extAX25 VC-wait-login VC-disc-on-linkfailure-msg VC-log-connections or parameters_extAX25 VC-reject-login VC-send-failure-msg VC-log-connections FILES
/etc/ax25/ax25d.conf SEE ALSO
ax25(4), netrom(4), rose(4), axports(5), nrports(5), rsports(5), ax25d(8). Linux 17 January 1997 AX25D.CONF(5)
All times are GMT -4. The time now is 09:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy