Sponsored Content
Top Forums Shell Programming and Scripting Removing from beginning to first : using awk Post 302467733 by malcomex999 on Sunday 31st of October 2010 03:03:24 AM
Old 10-31-2010
Quote:
Originally Posted by kristinu
I also want that only the first index value of 0 is outputted

This the line at run2 with index value 0 is deleted and thus the Best Value for it should not be shown.

npt02-sr40-syn-dc0p014-32x24drw-run2.log:0. Best Value = 0.00073609

Hence

Code:
npt02-sr40-syn-dc0p014-32x24drw.log:0. Best Value   = 0.00144914
npt02-sr40-syn-dc0p014-32x24drw.log:1. Best Value   = 0.00115706
npt02-sr40-syn-dc0p014-32x24drw.log:2. Best Value   = 0.00094345
npt02-sr40-syn-dc0p014-32x24drw.log:3. Best Value   = 0.000925552
npt02-sr40-syn-dc0p014-32x24drw.log:4. Best Value   = 0.000894649
npt02-sr40-syn-dc0p014-32x24drw.log:5. Best Value   = 0.000762455
npt02-sr40-syn-dc0p014-32x24drw.log:6. Best Value   = 0.000762455
npt02-sr40-syn-dc0p014-32x24drw.log:7. Best Value   = 0.00073609
npt02-sr40-syn-dc0p014-32x24drw.log:8. Best Value   = 0.00073609
npt02-sr40-syn-dc0p014-32x24drw-run2.log:0. Best Value   = 0.00073609
npt02-sr40-syn-dc0p014-32x24drw-run2.log:1. Best Value   = 0.000699646
npt02-sr40-syn-dc0p014-32x24drw-run2.log:2. Best Value   = 0.000699646

should result in

Code:
0. Best Value   = 0.00144914
1. Best Value   = 0.00115706
2. Best Value   = 0.00094345
3. Best Value   = 0.000925552
4. Best Value   = 0.000894649
5. Best Value   = 0.000762455
6. Best Value   = 0.000762455
7. Best Value   = 0.00073609
8. Best Value   = 0.00073609
9. Best Value   = 0.000699646
10. Best Value   = 0.000699646

Then Scrutinizer solution might be what you want...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using NR with two variables at the beginning of awk

hi My requirement is this: I have a file having around 100000 records pipe delimited. Now I want to compare record 1 with record 2 and similarly record3 with record 4, this goes on.. For this purpose i put a script as follows: #!bin/ksh ct_line=1 nxt_line=`expr ${ct_line} + 1` awk -F "|"... (1 Reply)
Discussion started by: ramkrix
1 Replies

2. Shell Programming and Scripting

Swapping lines beginning with certain words using sed/awk

I have a large file which reads like this: fixed-address 192.168.6.6 { hardware ethernet 00:22:64:5b:db:b1; host X; } fixed-address 192.168.6.7 { hardware ethernet 00:22:64:5b:db:b3; host Y; } fixed-address 192.168.6.8 { hardware ethernet 00:22:64:5b:db:b4; host A; }... (4 Replies)
Discussion started by: ksk
4 Replies

3. Shell Programming and Scripting

Removing one or more blank characters from beginning of a line

Hi, I was trying to remove the blank from beginning of a line. when I try: sed 's/^ +//' filename it does not work but when I try sed 's/^ *//' filename it works But I think the first command should have also replaced any line with one or more blanks. Kindly help me in understanding... (5 Replies)
Discussion started by: babom
5 Replies

4. Shell Programming and Scripting

One of the awk column spilling on the new line from beginning

I am having a problem where the Compute field/column is spilling over to the new line. Here's the piece of code and the o/p:- Code Sniplet:- for id in `qstat -u "*" -q "$Queue" -s r |sed -n '3,$ p'|awk -F" " '{print $1}'` do NODELIST=`cat /scratch/$id.hostlist.*|awk -F" " '{print $1,$2}'|tr '... (5 Replies)
Discussion started by: grish
5 Replies

5. Shell Programming and Scripting

Beginning awk question

I have a report that I'd like to print columns headers on. The code appears as follows: gawk '{for (i=1; i<=NF; i++) if ($i < 0) $i = -$i; print }'|gawk '{ printf "%-78s%-30s%-30s%-30s\n", $1,$2, $3, $4 }' |awk '{for (i=1; i<=NF; i++) if ($i < 0) $i = -$i; print }' report_1020I am trying to make... (3 Replies)
Discussion started by: newbie2010
3 Replies

6. Shell Programming and Scripting

Removing hyphen from beginning and end of a word only.

It is very simple to remove a hyphen from a word anywhere in that word using a simple sed command (sed -i 's/-//g' filename), but I am not able to figure out how to do this: For example, apple -orange tree pipe- banana-shake dupe- What my output should look like: apple orange tree... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Shell Programming and Scripting

Add words in beginning , end after removing a word in a file

My file has the entries like below... /dev/sds /dev/sdak /dev/sdbc /dev/sdbu I want to make the file like below echo 1 > /sys/block/sds/device/rescan echo 1 > /sys/block/sdak/device/rescan echo 1 > /sys/block/sdbc/device/rescan echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies

8. UNIX for Beginners Questions & Answers

Removing characters from beginning of multiple files

Hi, I have been searching how to do this but I can't seem to find how to do it. Hopefully someone can help. I have multiplr files, 100's example 12345-zxys.213423.zyz.txt. I want to be able to take all these files and remove the first '12345-' from each of the files. '12345-' these characters... (5 Replies)
Discussion started by: israr75
5 Replies

9. Shell Programming and Scripting

awk - help in removing some text

Hey Guys, Earlier I asked a question under Solaris, which I got great help... thanks. Although I got the script working for what it really needed to do, I am looking for a bit of help to change the output for nicer reading. my script gets a list of zones under a global-zone and puts this... (4 Replies)
Discussion started by: dakelly
4 Replies

10. Shell Programming and Scripting

Selecting text on multiple lines, then removing a beginning and end patterns

I have a file similar to the below. I am selecting only the paragraphs with @inlineifset. I am using the following command sed '/@inlineifset/,/^ *$/!d; s/@inlineifset{mrg, @btpar{@//' $flnm >> $ofln This produces @section Correlations between seismograms,,,,}} ... (5 Replies)
Discussion started by: Danette
5 Replies
IPROP-LOG(8)						    BSD System Manager's Manual 					      IPROP-LOG(8)

NAME
iprop-log -- maintain the iprop log file SYNOPSIS
iprop-log [--version] [-h | --help] command iprop-log truncate [-c file | --config-file=file] [-r string | --realm=string] [-h | --help] iprop-log dump [-c file | --config-file=file] [-r string | --realm=string] [-h | --help] iprop-log replay [--start-version=version-number] [--end-version=version-number] [-c file | --config-file=file] [-r string | --realm=string] [-h | --help] DESCRIPTION
Supported options: --version -h, --help command can be one of the following: truncate -c file, --config-file=file configuration file -r string, --realm=string realm Truncates the log. Sets the new logs version number for the to the last entry of the old log. If the log is truncted by emptying the file, the log will start over at the first version (0). dump -c file, --config-file=file configuration file -r string, --realm=string realm Print out all entries in the log to standard output. replay --start-version=version-number start replay with this version --end-version=version-number end replay with this version -c file, --config-file=file configuration file -r string, --realm=string realm Replay the changes from specified entries (or all if none is specified) in the transaction log to the database. last-version -c file, --config-file=file configuration file -r string, --realm=string realm prints the version of the last log entry. SEE ALSO
iprop(8) BSD
February 18, 2007 BSD
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy