ksh/nawk help with if statement to choose between 2 files
Hi! I am having a bit of a problem with my script. There are two different date formats that may appear in a file, either Jul-12 or Jul--6. I tried to create an if statement that searches for one of the formats and if that doesn't exist searches for the other, however it doesn't seem to be working. Please see below:
I think it has to do with the if statement as I ran it previously with only on of the two filelists and it worked properly. However, when the date changes to Jul10th and on I will need it to switch to the other format.
is there a way to choose the complement from the output from the sequense in "ksh -o vi"
root# ls
testa testb
root# cat tes
1) testa
2) testb
root# cat tes <-- what to do now?
this output looks like a select function, otherwise the numbers wouldn't make sense, is there a chance to use... (2 Replies)
I have:
datafile contains 1234567890
>wc -c datafile | awk '{print $1}'
>11
The program
#!/bin/ksh
let n = (wc -c datafile | awk '{print $1}')
echo $n
I expect n to be 11 but it gives error message. What is wrong with this statement?
Thanks! (3 Replies)
Hello,
First of all, I am trying to duplicate the sum command using ksh/nawk
Lets assume the following algorithms work just fine and there is no calculation errors what so ever (which I doubt at this minute).
For now, I wanna make sure the script uses the BSD algorithim if -r is used... (0 Replies)
Ok, So up front I'm going to say that I'm a very elementary scripter, and I tend to use tools I don't fully understand, but I shotgun at something until I can get it to work...that said, I can't for the life of me understand why I can't get this to go down the way I want it to.
The goal:
-to... (6 Replies)
I'm not confident at all on how arrays work.
I want to know how to set arrays in ksh and in nawk (is there a difference??)
if someone can show me some examples of both that will be great. Tried to look up on the net but was confusing me more.
Any help would be appreciated. (2 Replies)
Hello Everyone,
I don't know what is wrong with this:
Is it that nawk cannot run a ".sh" script or is it not treating "." as a literal. If so how to make "." be treated as a literal in "nawk" statemnts?
Thanks in Advance (2 Replies)
hi all
i have the following portion in an xml file:
</n:AOMessage>
<?xml version="1.0" encoding="UTF-8"?>
<n:AOMessage xmlns:n="urn:ao:hs:update:shell" xmlns:bo="urn:ao:hs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ao:hs:update:shell... (0 Replies)
I am trying to use either awk or nawk in ksh88 to grep the word "Reason" in multiple files and than print the lines that say "Reason" in a particular format that is different from how they would normally print. The original input is as follows:
... (10 Replies)
Hey all. I'm writing a script to automatically login to a router, change directories to where crashfiles are located, then listing all files in that directory. This is where I'm at so far and wish to have some user interaction to choose the files.
What I am trying to do is list the files and get... (1 Reply)
Discussion started by: Gouda
1 Replies
LEARN ABOUT OSX
mkbom
MKBOM(8) BSD System Manager's Manual MKBOM(8)NAME
mkbom -- create a bill-of-materials file
SYNOPSIS
mkbom [-s] directory bom
mkbom [-s] -i filelist bom
mkbom -h | --help
DESCRIPTION
The mkbom command creates a bill-of-materials (bom(5)). You must specify either a source as a directory, or a text file containing a file
listing as outputted by lsbom(8). mkbom will generate bill-of-materials information based on that information. Any existing bomfile will be
overwritten by the new bomfile.
Options:
-h print full usage
-s create a simplified bom containing only file paths
-i filelist use the information in filelist, one entry per line, to construct the bom file. The format of the file should match lsbom(8)
output with no formatting options (the default). If -s is given to mkbom, the input filelist should contain only pathnames, as
with lsbom -s.
SEE ALSO bom(5), ditto(8), mkbom(8)HISTORY
The mkbom command appeared in NeXTSTEP as a tool to create bom files used during installation.
Mac OS X September 26, 2006 Mac OS X