Visit Our UNIX and Linux User Community

Full Discussion: [SHELL] Output formatting
Top Forums Shell Programming and Scripting [SHELL] Output formatting Post 302238420 by cfajohnson on Friday 19th of September 2008 11:10:04 PM
Old 09-20-2008
Originally Posted by DeCoTwc
Sorry to thread jack, could you explain that a little more please?

Say I have a file with 5 ip address's:
and I wanted to ping each one of them, I'd typically do something like:

for i in `cat ips.out`;do ping $i;done

What is it that is wrong with this method?
I mean I wouldn't normally put it in a script...but you know what I mean.

In this case, it doesn't matter all that much, but it's an inefficient method. It uses cat (an external command, and therefore slow) unnecessarily, and causes extra work for the shell in splitting the output of cat into separate arguments.

However, if any of the lines contained spaces, it would also split the line and $i would be assigned each word separately.

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting output

Hi need some advice.. #grep -i hostname test.csv (gives the below output) HOSTNAME,name,host_test,,,,,,,, Now I need to format the above output as below. HOSTNAME: name=host_test Any easy way of doing this using awk or sed or printf? (4 Replies)
Discussion started by: balaji_prk
4 Replies

2. Shell Programming and Scripting

Output Formatting

Hi Guys I need help removing some lines from output i am receiving from a shell script. Here is the output: I am trying to remove the output that i have circled. . ${EDW}/extracts/bin/ . ${EDW}/extracts/extracts.conf ... (7 Replies)
Discussion started by: mooey1232003
7 Replies

3. Shell Programming and Scripting

Formatting the query output using shell script

Hi All, I'm finding it difficult to format the query output that was returned in a shell script. Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql. Intitally my... (5 Replies)
Discussion started by: RSC1985
5 Replies

4. Shell Programming and Scripting

sql select command output formatting in shell script

Hi, I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification in short select var,data from usage; o/p=... (1 Reply)
Discussion started by: rkrish
1 Replies

5. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

6. Shell Programming and Scripting

Formatting the output

Hi, I have a file which contents entries in this form. Only in /data4/temp abc.000001 Only in /data4/temp abc.000003 Only in /data4/temp abc.000012 Only in /data4/temp abc.000120 Only in /data4/temp abc.000133 Only in /data4/temp abc.001444 i want to read line by line and format... (2 Replies)
Discussion started by: arijitsaha
2 Replies

7. Shell Programming and Scripting

Formatting Shell script output to Excel

I am facing a problem formatting the output of my shell script in excel. We are directing the output of the script to an excel sheet and need long integer type data printed in Excel as it is (i.e. not in the default scientific notation). Also, leading zeroes(if any) in the output are getting... (4 Replies)
Discussion started by: bornali.p
4 Replies

8. AIX

Help Formatting Output

I am using FORTRAN 90 on AIX 5.3 and need to output my data to a tab-delimited file. It must have actual tabs, and I cannot figure out a way to make it work. The resulting file will be imported into another application (quickbooks) as an .iif file....for some reason, it needs the tabs; spaces do... (2 Replies)
Discussion started by: KathyB148
2 Replies

9. Shell Programming and Scripting

Formatting output

I have the output like below: DEV#: 9 DEVICE NAME: hdisk9 TYPE: 1750500 ALGORITHM: Load Balance SERIAL: 68173531021 ========================================================================== Path# Adapter/Path Name State Mode Select Errors 0 ... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

10. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies
RLM_IPPOOL_TOOL(8)					      System Manager's Manual						RLM_IPPOOL_TOOL(8)

rlm_ippool_tool - dump the contents of the FreeRadius ippool database files SYNOPSIS
If an ipaddress is specified then that address is used to limit the actions or output. rlm_ippool_tool [-a] [-c] [-o] [-v] session-db index-db [ipaddress] Mark the entry nasIP/nasPort as having ipaddress rlm_ippool_tool -n session-db index-db ipaddress nasIP nasPort Update old format database to new. rlm_ippool_tool -u session-db new-session-db DESCRIPTION
rlm_ippool_tool dumps the contents of the FreeRADIUS ippool databases for analyses or for removal of active (stuck?) entries. Or with the -n argument adds a usage entry to the FreeRADIUS ippool databases. OPTIONS
-a Print all active entries. -c Report number of active entries. -r Remove active entries. -v Verbose report of all entries. -o Assume old database format (nas/port pair, not md5 output). -n Mark the entry nasIP/nasPort as having ipaddress. -u Update old format database to new. EXAMPLES
Given the syntax in the FreeRadius radiusd.conf: ippool myippool { range-start = range-stop = [...] session-db = ${raddbdir}/ip-pool.db ip-index = ${raddbdir}/ip-index.db } To see the number of active entries in this pool, use: $ rlm_ippool_tool -c ip-pool.db ip-index.db 13 To see all active entries in this pool, use: $ rlm_ippool_tool -a ip-pool.db ip-index.db [...] To see all information about the active entries in the use, use: $ rlm_ippool_tool -av ip-pool.db ip-index.db NAS: port:0x2e8 - ipaddr: active:1 cli:0 num:1 NAS: port:0x17c - ipaddr: active:1 cli:0 num:1 NAS: port:0x106 - ipaddr: active:1 cli:0 num:1 NAS: port:0x157 - ipaddr: active:1 cli:0 num:1 NAS: port:0x2d8 - ipaddr: active:1 cli:0 num:1 NAS: port:0x162 - ipaddr: active:1 cli:0 num:1 [...] To see only information of one entry, use: $ rlm_ippool_tool -v ip-pool.db ip-index.db NAS: port:0x90 - ipaddr: active:0 cli:0 num:0 To add an IP address usage entry, use: $ rlm_ippool_tool -n ip-pool.db ip-index.db 0x90 rlm_ippool_tool: Allocating ip to nas/port: rlm_ippool_tool: num: 1 rlm_ippool_tool: Allocated ip to client on nas,port 144 SEE ALSO
radiusd(8) AUTHORS
Currently part of the FreeRADIUS Project ( Originally by Edwin Groothuis, ( Mailing list details are at RLM_IPPOOL_TOOL(8)

Featured Tech Videos

All times are GMT -4. The time now is 04:13 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy