06-02-2017
Dear
bobbygsk ,
With 149 posts to date, I'm hoping you could answer these basic questions first:-
- Is this homework/assignment? There are specific forums for these.
- What have you tried so far?
- What output/errors do you get?
- What OS and version are you using?
- What are your preferred tools? (C, shell, perl, awk, etc.)
- What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly,
What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
Kind regards,
Robin
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to know value for previous row, in addition to current row.
How would I will get value for previous row? How can I perform this with awk? (2 Replies)
Discussion started by: videsh77
2 Replies
2. Shell Programming and Scripting
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies
3. Shell Programming and Scripting
Hello,
I have an input file like the following:
11_3_4
2_1_35
3_15__
_16989
Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Discussion started by: jl487
2 Replies
4. Shell Programming and Scripting
I have data like:
Blue Apple 6
Red Apple 7
Yellow Apple 8
Green Banana 2
Purple Banana 8
Orange Pear 11
What I want to do is if $2 in a row is the same as $2 in the previous row remove that row. An identical $2 may exist more than one time.
So the out file would look like:
Blue... (4 Replies)
Discussion started by: dcfargo
4 Replies
5. Shell Programming and Scripting
Hi All,
I have 100 files with names like this:
1.dat, 2.dat, 3.dat until 100.dat.
My dat files look like this:
42323 0
438939 1
434 0
0.9383
3434
120.23 3
234
As you can see in the second column, some numbers are missing. I want to fill those missing places with 0's in all... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
6. Shell Programming and Scripting
Hello,
I am fairly new to awk, and I have the following problem.
My file has missing data in the last column, and the program I am pre-processing this file for cannot interpret correctly shortened rows (it just wraps the data around).
Is there a way to force awk to create the same... (6 Replies)
Discussion started by: timert34
6 Replies
7. Shell Programming and Scripting
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies
8. UNIX for Dummies Questions & Answers
file with this content
awk 'NR==1 {print $4} && NR==2 {print $5}' file
The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies
9. Shell Programming and Scripting
Gents,
Kindly help me.
I have a file with empty values in selected column, I will like to fill the empty values with the previous value.
Example
Input file
X 4959 30010 66727.00 20457.001 1 1441 66512.00 20234.00 20520.001
X 4959 30010 66727.00 20457.001 145 ... (7 Replies)
Discussion started by: jiam912
7 Replies
10. Shell Programming and Scripting
Hi All ,
I have to write one Perl script in which I need to read one pre-existing xls and based on pattern match for one word in some cells of the XLS , I need to fill the entire row with one color of that matched cell and write the content to another excel
Please find the below stated... (2 Replies)
Discussion started by: kshitij
2 Replies
lib(3pm) Perl Programmers Reference Guide lib(3pm)
NAME
lib - manipulate @INC at compile time
SYNOPSIS
use lib LIST;
no lib LIST;
DESCRIPTION
This is a small simple module which simplifies the manipulation of @INC at compile time.
It is typically used to add extra directories to perl's search path so that later "use" or "require" statements will find modules which are
not located on perl's default search path.
Adding directories to @INC
The parameters to "use lib" are added to the start of the perl search path. Saying
use lib LIST;
is almost the same as saying
BEGIN { unshift(@INC, LIST) }
For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so
the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir.
To avoid memory leaks, all trailing duplicate entries in @INC are removed.
Deleting directories from @INC
You should normally only add directories to @INC. If you need to delete directories from @INC take care to only delete those which you
added yourself or which you are certain are not needed by other modules in your script. Other modules may have added directories which
they need for correct operation.
The "no lib" statement deletes all instances of each named directory from @INC.
For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so
the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is also deleted from @INC.
Restoring original @INC
When the lib module is first loaded it records the current value of @INC in an array @lib::ORIG_INC. To restore @INC to that value you can
say
@INC = @lib::ORIG_INC;
CAVEATS
In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users
must first translate their file paths to Unix conventions.
# VMS users wanting to put [.stuff.moo] into
# their @INC would write
use lib 'stuff/moo';
NOTES
In the future, this module will likely use File::Spec for determining paths, as it does now for Mac OS (where Unix-style or Mac-style paths
work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC).
SEE ALSO
FindBin - optional module which deals with paths relative to the source file.
AUTHOR
Tim Bunce, 2nd June 1995.
perl v5.8.0 2002-06-01 lib(3pm)