Some more generic solution for this kind of needs. Works every Posix compatible shells (ksh, bash, ...).
Or using builtin substr command, not external ex. cut, awk, expr, ...
I have a script that converts a file into an html table. This script works fine for a 1 column table. However, I'm trying to do this for a multi-column table. My input file will look something like this:
a b c
d e f
g h i
My script basically works by taking in each line and putting that... (2 Replies)
OK guys I think this is an easy one but i am having a bit of trouble getting a while loop I have to do what I want. I need it to increment a number 1 - 99 but I need it to use 2 digits. So not 1,2,3,4,5...99 but 01,02,03,04,05,06,07...10,11,12,...99. Always using 2 digits.
I tried this:
... (3 Replies)
I have a function "MyPrint" that runs great on a file (BaseData.txt) that has one line of data. If i add rows to the text file it's reading the tFile variable becomes a list of every field 2 in the file. To correct this, i tried to call the function from a loop where i read one line at a time and... (4 Replies)
The script is following :
for each_rec in <file_name>
do
count=`cut -c -2 ${each_rec} | grep "45"`
echo ${count}
if ] then
amount=`cut -c 24-35 ${each_rec}`
echo ${amount}
else
echo "failed"
fi
done
And the file looks like below :
... (4 Replies)
I don't know if I described this right, but I am new to scripting and this is giving me a little bit of trouble, but I will explain what I am trying to do.
Each time this is run, I want it to grab and save ls -l /home to data.txt.
ls -l /home > data.txt
Now the part I am getting confused... (4 Replies)
Hi
Can anyone what I am doing wrong while using cut command.
for f in *.log
do
logfilename=$f
Log "Log file Name: $logfilename"
logfile1=`basename $logfilename .log`
flength=${#logfile1}
Log "file length $flength"
from_length=$(($flength - 15))
Log "from... (2 Replies)
hay
i am trying to get JUST the PID from the ps command.
my command line is:
ps -ef | grep "mintty" | cut -d' ' -f2
but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that.
i know i can use awk or cut... (8 Replies)
I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Hi,
i have a source file and have 3 columns and separated by "|" .i want to split this 3 columns in different variable.When i am executing this values indivisually giving correct result but when the same execute inside a for loop,it's giving issues.
Src file(jjj.txt)
-------... (8 Replies)
Discussion started by: raju2016
8 Replies
LEARN ABOUT DEBIAN
xpacmdnew
xpacmdnew(3) SAORD Documentation xpacmdnew(3)NAME
XPACmdNew - create a new XPA public access point for commands
SYNOPSIS
#include <xpa.h>
XPA XPACmdNew(char *class, char *name);
DESCRIPTION
Create a new XPA public access point for commands that will share a common identifier class:name. Enter this access point into the XPA name
server, so that it can be accessed by external processes. XPACmdNew() returns an XPA struct.
It often is more convenient to have one public access point that can manage a number of commands, rather than having individual access
points for each command. For example, it is easier to command the ds9 image display using:
echo "colormap I8" | xpaset ds9
echo "scale log" | xpaset ds9
echo "file foo.fits" | xpaset ds9
then to use:
echo "I8" | xpaset ds9_colormap
echo "log" | xpaset ds9_scale
echo "foo.fits" | xpaset ds9_file
In the first case, the commands remain the same regardless of the target XPA name. In the second case, the command names must change for
each instance of ds9. That is, if a second instance of ds9 called DS9 were running, it would be commanded either as:
echo "colormap I8" | xpaset DS9
echo "scale log" | xpaset DS9
echo "file foo.fits" | xpaset DS9
or as:
echo "I8" | xpaset DS9_colormap
echo "log" | xpaset DS9_scale
echo "foo.fits" | xpaset DS9_file
Thus, in cases where a program is going to manage many commands, it generally is easier to define them as commands associated with the
XPACmdNew() routine, rather than as separate access points using XPANew().
When XPACmdNew() is called, only the class:name identifier is specified. Each sub-command is subsequently defined using the XPACmdAdd()
routine.
SEE ALSO
See xpa(7) for a list of XPA help pages
version 2.1.14 June 7, 2012 xpacmdnew(3)