Sponsored Content
Full Discussion: Whats wrong with this line?
Top Forums Shell Programming and Scripting Whats wrong with this line? Post 302214577 by looza on Monday 14th of July 2008 09:58:00 AM
Old 07-14-2008
$I_FILE="ifile";
where ifile looks like this
4294967295,0,3,2103159,54668771,54668771,0,1,566547,8770,0,384,228,18,12
4294967295,0,4,2103160,54668772,54668772,0,1,566548,8770,0,384,228,18,12
4294967295,1,0,2103161,54668773,54668773,0,3,566549,8770,0,384,228,18,12
4294967295,2,0,2103162,54668774,54668774,0,5,566550,8770,0,384,228,18,12

I need to filter out the first and the ninth column:
4294967295 566547
4294967295 566548
4294967295 566549
4294967295 566550

hence:
system ("awk -F, '{print \$1, \$9}' \$I_FILE | sed '\/^\$\/d' > O_FILE")

I dont *have* to use awk/sed. If there is a simpler way with Perl, that would work too.
Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

whats wrong with this awk???

while read LINE; do echo |awk -v LIN="${LINE}" '{print substr(LIN,1,7)","substr(LIN,8,5)" ,"substr(LIN,14,10)","substr(LIN,24,6)" ,"substr(LIN,30,8)}'; done < exp1.txt exp1.txt = 1234 grgrg 203902 ksdjh oehr weo why it doesn't work?? thanks. (5 Replies)
Discussion started by: george_
5 Replies

2. Shell Programming and Scripting

Whats wrong with this 5 line script!

Hi #!/bin/sh user=$1 if " -eq 0 ] echo "No" else echo "Yes" fi I'm not quite sure whats wrong with this but I know its something silly. Any ideas? Thanks (9 Replies)
Discussion started by: c19h28O2
9 Replies

3. Shell Programming and Scripting

Whats wrong with this script?

Hi all, #!/bin/ksh BIN=/interface/Gunner age=$1 directory="$2" && directory=. cd "$directory" || exit 1 from=`$BIN/today -$age` cd $BIN for i in `cat filestoarchive.txt`;do cd $i find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \ done (2 Replies)
Discussion started by: kayarsenal
2 Replies

4. Shell Programming and Scripting

tell me whats wrong in this?

#! /bin/bash head -5 $1 echo "remove $1 ?" read answer if then echo invalid answer elif rm $1 echo "$1 is deleted" elif then echo file is not deleted else echo "invalid answer" fi What i really want this to do is to ask to delete the file or not..it says something wrong... (1 Reply)
Discussion started by: nadman123
1 Replies

5. Shell Programming and Scripting

tell me whats wrong with this

#! /bin/bash USAGE=" | ] if then echo "$USAGE" exit 1 fi while getopts lb: OPTION do case $(OPTION)in a) echo Hi there! exit 2;; b) echo hello o) OARG=$OPTARG;; \?)echo "$USAGE" ;; exit 2;; esac done shift `expr... (1 Reply)
Discussion started by: nadman123
1 Replies

6. Shell Programming and Scripting

whats wrong with this line using perl

E:\>perl -00ne 'push @a,"$_\0$ARGV\n";END{print reverse split/\0/ for sort @a}' file1-obj_prof.out.txt file2-obj_prof.out.txt' Can't find string terminator "'" anywhere before EOF at -e line 1. (6 Replies)
Discussion started by: richsark
6 Replies

7. UNIX for Dummies Questions & Answers

whats wrong with this?

can anyone tell me why this code doesn't work how its supposed to, its the hangman game but it doesn't play how its supposed to #!/bin/bash NoAttempts="0" livesgiven="5" LivesRemain=$livesgiven LettersAttempted="" wordfile=words numwords=0 function menu() { clear cat << menu... (1 Reply)
Discussion started by: ferrycorsten73
1 Replies

8. Shell Programming and Scripting

Whats wrong in the Function ?

Need your assistance, to find the bug in the function. Function usage erroring out even after passing parameters. usage() { if || ; then echo "************************************************************" echo " CHECK USAGE FOR CORRECT PARAMETERS ... (26 Replies)
Discussion started by: raghunsi
26 Replies

9. Homework & Coursework Questions

Whats wrong with the following

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: ls -ld htdocs drwxr-x--- 3 root root 8192 2006-11-19 10:41 htdocs How would a host administrator... (1 Reply)
Discussion started by: Larry_1
1 Replies

10. UNIX for Dummies Questions & Answers

Whats wrong with this if-else

hi whats wrong in below?? CHECK=M10; if ; then echo "hello hi"; else echo "how are u hello hi"; fi I am getting error as ./test.sh: line 2: ' ./test.sh: line 2: M10: command not found ./test.sh: line 2: M10: command not found ./test.sh: line 2: M10: command not found (8 Replies)
Discussion started by: skyineyes
8 Replies
dhcpclient(1M)															    dhcpclient(1M)

NAME
dhcpclient - Client for Dynamic Host Configuration Protocol Server SYNOPSIS
hostname] tracefile] class-id] debug_level] server_ipaddress] log_type] send_attempts] time_to_wait] interface server_ipaddress] hostname] tracefile] debug_level] interface server_ipaddress] log_type] time_to_wait] tracefile] debug_level] interface server_ipaddress] log_type] DESCRIPTION
is used to obtain the configuration parameters from the Dynamic Host Configuration Protocol server (bootpd(1M)) to configure the host. Currently, supports 10bt(10BaseT) and 100bt(100BaseT) networks only. It does not support networks. is invoked by the script (see auto_parms(1M)) at boot up. The file is used for the configuration of the interfaces. To invoke using the script, set the variable to a non-zero value in the file. can also be invoked at the command prompt, when the interface is not configured. Once the obtains the configuration parameters from the server, it is stored in a configuration file named The configuration parameters are valid for a fixed time, lease time. The configuration information in file will be of the following format. The length field denotes the length of the data field following it. All these lines collectively indicate one record. The configuration file will have series of records. Since this file contains all the configuration information, it can be used to identify the server from which the configuration parameters were obtained. The configuration file can also be used to obtain the same configuration parameters from the server. So, once the is invoked, it will try to read the configuration file, While trying to read the file, the following conditions are possible: 1. It may be possible that the configuration file had been deleted or it may not be available for reading. 2. The file may have got corrupted and contains irrelevant data for the particular interface. 3. There may be no configuration information for the particular interface. 4. User may have specified option meaning that a new lease is needed. For all of the above cases, has to first find the server which is ready for the service. For this purpose, it will send a message. If the user has specified server_ipaddress using the option, then replies only from the specified server will be accepted. The server in turn will reply with the configuration parameters that it can offer. This message is called If the client has sent the to broadcast address, then it will receive from more than one server. The selects one of the obtained. Then, it will send to the server, requesting the configu- ration parameters. The server will reply with a positive acknowledgement called if it is willing to send the configuration parameters to the host and with a negative acknowledgement, if it is not willing to do so. If the has received it will copy all the configuration parame- ters to the configuration file, else, it will send another message and repeat the whole process. This process is called "Obtaining a new lease". If all the above 4 cases are not true, then the can directly send the message and obtain the configuration parameters as mentioned above. This process is called "Renewing the lease". The various options supported by are as described below. Options When this option is used, the client will accept the reply from the server only if the in the request and reply packet matches. This option is used to send a hostname. The hostname should be specified as an ASCII string. This option is used during bootup time to obtain a new lease. If the client is trying to obtain the configuration parameters from the server for the first time, then does not exist. So, using this option, the client obtains a new lease for the interface specified. This option is used for dumping the internal data of an interface. A sample dump is shown below. This option is used to specify the file name for the debugging output. This option is used for specifying the of the device group. should be specified as an ASCII string. This option is used for logging of debug information. debug_level specifies the amount of debug information logged. The debugging messages are sent to This option is used for maintaining the lease. When invoked with this option, the runs as a daemon. The calculates how much time it needs to sleep before the lease needs to be renewed and then sleeps for that time. When it wakes up, it extends the lease by sending the request to the server. This option is used for ignoring the current lease. When this option is used, the current configuration information is discarded and request for a new lease is sent. This option is used for tracing the packets. It displays the packet contents in a readable format. This option is used for releasing a lease. The releases all the assigned configuration parameters. This is done by sending the message to the server. The dhcpclient then empties the record corresponding to that interface in the configuration file, This option is used to specify the ip address of the server from which the reply should be accepted. server_ipaddress must be a unicast IP address specified in dotted decimal form. If the log_type is a non zero value and if the debug_level is low enough for the process to detach from the tty (see syslog(3C)), then, the logging goes to else it goes to This option is used when the is running as a daemon. This option prints the various version strings of the to stdout. This option is used to specify the number of attempts the packet should be sent before obtaining a reply. send_attempts must be specified as an unsigned number. This option is used to specify the time interval between successive packet retransmission. time_to_wait will be in seconds. EXAMPLES
To the lease for the interface lan0 and invoke logging in the following set of commands is invoked at the command prompt: To trace the packet and get the debugging messages, use: This is an example of a file. 00 4 lan0 01 5 dhcph 02 0 03 0 04 0 05 0 06 4 4294967295 07 4 4294967295 08 4 0 09 4 0 10 4 1 11 6 8 0 9 25 a5 b1 12 4 192.11.22.107 13 4 255.255.255.0 14 4 0.0.0.0 15 0 16 4 192.11.22.3 17 4 192.11.22.3 18 0 19 0 20 0 21 4 0.0.0.0 22 0 23 0 24 39 63 82 53 63 35 1 5 33 4 ff ff ff ff 36 4 c0 b8 16 3 1 4 ff ff ff 0 c 5 64 68 63 70 68 2 4 ff ff b2 a8 ff AUTHOR
was developed by HP. FILES
configuration file. SEE ALSO
auto_parms(1M), bootpd(1M), bootpquery(1M), dhcptools(1M), syslog(3C). DARPA Internet Request For Comments: RFC1541, RFC1542, RFC1533, RFC1534, Assigned Numbers RFC. dhcpclient(1M)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy