Check if this helps.
OR just (if suitable)
If not, how is the output, any error? Pls post the result.
Also as Scrutinizer told, U can process whole file in one go, no need to read file line by line
Hi all,
Am trying to execute a loop but having some troubles...
Files that will be query'd use the Julian date (eg: cpu032, cpu365) in their naming convention.
I'm a little lost how to maintain the three character format of the numeric portion of the file name while cycling backwards(or... (13 Replies)
unix program to which a directory name will be passed as
parameter. This directory will contain files with various
extensions. This script will create directories with the names of the
extention of the files and then put the files in the
corresponding folder. All files which do not have any... (2 Replies)
Hi,
I am a newbie to the UNIX world. I am asked to edit the file in hexadecimal format and save it. Later I should be able to print the file in char mode.
please anyone tell me how to do that mostly using VI editor. (1 Reply)
Hi all,
I have a file with 3 columns separated by space. Each column has a heading. I want to sort according to the values in the 2nd column (ascending order).
Ex.
Name rank direction
goory 0.05 --+
laby 0.0006 ---
namy 0.31 -+-
....etc.
Output should be
Name rank direction
laby... (3 Replies)
Currently I have the following to separate the numeric values. However the decimal point get separated.
ls -lrt *smp*.cmd | awk '{print $NF}' | sed 's/^.*\///' | sed 's/\(*\)/ & /g'
As an example on the files
n02-z30-dsr65-terr0.50-dc0.05-4x3smp.cmd... (8 Replies)
I have a text file that has data like:
Data "12345#22"
Fred
ID 12345
Age 45
Wilma
Dino
Data "123#22"
Tarzan
ID 123
Age 33
Jane
I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes:
Data "1012345#22"
Fred
ID... (16 Replies)
Hi All,
I am trying write a simple command using AWK and SED to this but without any success.
Here is what I am using:
head -1 test1.txt>test2.txt|sed '1d;$d' test1.txt|awk '{print substr($0,0,(length($0)-2))}' >>test2.txt|tail -1 test1.txt>>test2.txt
Input:
Header
1234567
abcdefgh... (2 Replies)
Hi Unix Gurus,
I need to grep for a block that is between a start and end keyword and then in between I need to find and replace a keyword.
for eg: I need to search between Test = 000; and Test = 000; and find K9 and replace with M9
INPUT FILE
Define {
Replace = K9;
Test =... (6 Replies)
Hello friends,
I have a file with duplicate lines. I could eliminate duplicate lines by running
sort <file> |uniq >uniq_file and it works fine BUT it changes the order of the entries as it we did "sort".
I need to remove duplicates and also need to keep the order/sequence of entries. I... (1 Reply)
I have 2 input files (tab separated):
file1:
make_A 1990 foo bar
make_B 2010 this that
make_C 2004 these those
file2:
make_X 1970 1995 ref_1:43 ref_2:65
make_A 1970 1995 ref_1:4 ref_2:21 ref_3:18
make_A 1980 2002 ref_1:7 ref_2:7 ref_3:0 ... (2 Replies)
Discussion started by: beca123456
2 Replies
LEARN ABOUT DEBIAN
plan9-getflags
GETFLAGS(8) System Manager's Manual GETFLAGS(8)NAME
getflags, usage - command-line parsing for shell scripts
SYNOPSIS
getflags $*
usage [ progname ]
DESCRIPTION
Getflags parses the options in its command-line arguments according to the environment variable $flagfmt. This variable should be a list
of comma-separated options. Each option can be a single letter, indicating that it does not take arguments, or a letter followed by the
space-separated names of its arguments. Getflags prints an rc(1) script on standard output which initializes the environment variable
$flagx for every option mentioned in $flagfmt. If the option is not present on the command-line, the script sets that option's flag vari-
able to an empty list. Otherwise, the script sets that option's flag variable with a list containing the option's arguments or, if the
option takes no arguments, with the string 1. The script also sets the variable $* to the list of arguments following the options. The
final line in the script sets the $status variable, to the empty string on success and to the string usage when there is an error parsing
the command line.
Usage prints a usage message to standard error. It creates the message using $flagfmt, as described above, $args, which should contain the
string to be printed explaining non-option arguments, and $0, the program name (see rc(1)). If run under sh(1), which does not set $0, the
program name must be given explicitly on the command line.
EXAMPLE
Parse the arguments for leak(1):
flagfmt='b,s,f binary,r res,x width'
args='name | pid list'
if(! ifs=() eval `{getflags $*} || ~ $#* 0){
usage
exit usage
}
SOURCE
/src/cmd/getflags.c
/src/cmd/usage.c
SEE ALSO arg(3)GETFLAGS(8)