11-07-2013
i am sorry . I forgot to mention that "a" will be of variable length 1-9 characters.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Let's say I write a simple script that contains the following:
date | awk '{print $1}'
date | awk '{print $2}'
Of course, when I run the script the output will look similar to:
Tue
Mar
What if I want my ouput to be on one line as follows:
Tue Mar
What changes would I need to... (2 Replies)
Discussion started by: cdunavent
2 Replies
2. Shell Programming and Scripting
Hi,
I need to insert a line at a particular line number. I am using the below code:
sed $REV_LINO_NO" i\\
# $CURRENT_DATE $NAME Changed pwd for cindy\'s id" file > file1
This code works, but the formatting is not as I expected. For example, I get lines as shown below... (2 Replies)
Discussion started by: sugan
2 Replies
3. Shell Programming and Scripting
hi
I have a string pattern like
...
...
000446448742 00432265 040520100408 21974435 DEWSWATER GARRIER AAG IK4000 N 017500180000000000000000077000000000100
000446448742 00580937 040520100408 32083576 PEWSWATER BARRIER DAG GK4000 ... (6 Replies)
Discussion started by: zainravi
6 Replies
4. Shell Programming and Scripting
Dear all
I require help with AWK regarding this situation
Input is :
fn1 12345
fn1 23456
fn3 231513
fn1 22325
fn3 123125
Desired output is
fn1 12345 23456 22325
fn3 231513 123125 (5 Replies)
Discussion started by: Peasant
5 Replies
5. Shell Programming and Scripting
when i try this awk its giving out put as below.
awk '!(/^$/||/--/||/selected/||/^ *$/){print $1}' tmp.txt
output
=====
1
2010-08-03-12.31.26.126000
how excluede the 1st line ? i mean i want output only 2nd line i.e 2010-08-03-12.31.26.126000; (5 Replies)
Discussion started by: rocking77
5 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I'm writing a simple awk code:
awk 'BEGIN {FS="|"};{print "Type\tNumber\ttypes\tTotal";};{print $1, "\t", $2, "\t", $3, "\t", $4, "\t";}' db_query.txt
it gives me the result:
Type Number types Total
XXX 498.0 5100.0 5274.661
Type Number types Total... (7 Replies)
Discussion started by: messi777
7 Replies
7. Shell Programming and Scripting
75
103
131
133
138
183
197
221
232
234
248
256
286
342
368
389
463
499
524
538 (5 Replies)
Discussion started by: chrisjorg
5 Replies
8. Shell Programming and Scripting
trying to write up a script to put the suffix back.
heres what I have but can't get it to do anything :(
would like it to be name.date.suffix
rsync -zrlpoDtub --suffix=".`date +%Y%m%d%k%M%S`.~" --bwlimit=1024 /mymounts/test1/ /mymounts/test2/
while IFS=. read -r -u 9 -d '' name... (1 Reply)
Discussion started by: jmituzas
1 Replies
9. UNIX for Dummies Questions & Answers
Hi all,
Is it possible to tell awk that the first line of text is a header and then print dashes after it is printed before it prints the rest of the text?
Note example below:
Source file:
Filesystem kbytes used avail capacity Mounted on
server-p01:/vol/vol_vol01/db01... (3 Replies)
Discussion started by: newbie_01
3 Replies
10. Shell Programming and Scripting
Please help me to get required output for both scenario 1 and scenario 2 and need separate code for both scenario 1 and scenario 2
Scenario 1
i need to do below changes only when column1 is CR and column3 has duplicates rows/values. This inputfile can contain 100 of this duplicated rows of... (1 Reply)
Discussion started by: as7951
1 Replies
LEARN ABOUT ULTRIX
mktemp
mktemp(1) General Commands Manual mktemp(1)
Name
mktemp - make a name for a temporary file
Syntax
mktemp [ -c ] [ -d directory_name ] [ -p prefix ]
Description
The command makes a name for the pathname of a temporary file and writes that name to standard output. The name will not duplicate that of
an existing file. The command does not create a new file. The file named must actually be created before can generate a new filename.
Subsequent calls to will only generate a new file name if all previously generated file names have been created by the user and still
exist. Error messages are written to standard error.
The directory_name generated by is the concatenation of a directory name, a slash (/), a file prefix, a dot (.), a four digit number and a
unique character.
The directory name is chosen as follows:
(1) If the -d option is specified, directory_name is used.
(2) Otherwise, if the TMPDIR environment variable is set and a string that would yield a unique name can be obtained using the value of
that variable as a directory name, this value is used.
(3) Otherwise, is used.
The prefix is chosen as follows:
(1) If the -p option is specified, prefix is used.
(2) Otherwise, if the LOGNAME environment variable is set, it is used as the prefix.
(3) Otherwise, the user's login name is used.
Options
-c Causes to attempt to create a regular file using the generated (or created) name string. If file creation is successful, a zero
length file is created with access permissions derived from the process's file mode creation mask, see No attempt is made to
create a file if the length of the generated (or created) name string exceeds 1023 characters. It is the user's responsibility
to remove files created by use of this option.
-d directory_name
Causes directory_name to be used as the directory portion of the pathname. In this case, directory_name is used instead of
TMPDIR and
-p prefix Causes the string prefix to be used as the file's prefix. It is used instead of LOGNAM and the user's login name. If the pre-
fix is longer the 249 characters, it will be silently truncated to that length before the concatenation of the suffix.
Environmental Variables
LOGNAME When the -p prefix option is not specified, the value of this variable is used as the prefix of the filename, if it exists.
TMPDIR When the -d directory_name option is not specified, the value of this variable is used instead of
Restrictions
If the user does not have write permission in the directory specified, and error message is reported and is used in its place. The entire
path name can not exceed 1023 characters, and the temporary file name can not exceed 255 characters. If the generated file name is too long
it is truncated to fit before the suffix is added.
See Also
mktemp(1)