07-29-2013
Thanks All for your reply.
I am getting result with pamu's code.
But I still dont understand why there is issue with cat and cut command.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to read in a 2 column data file into Perl Hash array index. Here is my code.
#!/usr/bin/perl -w
use strict;
use warnings;
my $file = "file_a";
my @line = ();
my $index = 0;
my %ind_file = ();
open(FILE, $file) or die($!);
while(<FILE>) {
chomp($_);
if ($_ eq '')
{
... (1 Reply)
Discussion started by: subhap
1 Replies
2. Shell Programming and Scripting
Hi Everyone!
I have a problem in reading a specific column from .xls file using perl language and then manipulating on given criteria.
Detailed Description of the problem::
I have one .xls file, in which i have to populate two columns based on Period_date column which is in same file.
My... (1 Reply)
Discussion started by: kvth
1 Replies
3. Shell Programming and Scripting
consider the small piece of code
while read line
do
echo $line
done < example
content of example file
sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr
the output is like
sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr
the... (4 Replies)
Discussion started by: Kesavan
4 Replies
4. UNIX for Dummies Questions & Answers
How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies
5. Shell Programming and Scripting
Hi,
For my reuirement, I have to read a file from the 2nd line till the last line<EOF>.
Say,
I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines.
for i in `cat test.txt`
{
echo $i
}
While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies
6. UNIX for Dummies Questions & Answers
I have a space delimited text file with two columns. I would like to add NA to the first column of the text file.
Input:
19625 10.4791768259
19700 10.8146489183
19701 10.9084026759
19702 10.9861346978
19703 10.9304364984
Output:
NA19625 10.4791768259
NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies
7. UNIX for Dummies Questions & Answers
I have a space delimited text file. I want to extract rows where the third column has 0 as a value and write those rows into a new space delimited text file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies
8. Shell Programming and Scripting
Hi,
I am not so familiar with bash scripting and would appreciate your help here.
I have a text file 'input.txt' like this:
2 3 4
5 6 7
8 9 10
I want to store each column in an array like this
a ={2 5 8}, b={3 6 9}, c={4 7 10}
so that i can access any element, e.g b=6 for the later use. (1 Reply)
Discussion started by: Asif Siddique
1 Replies
9. Shell Programming and Scripting
Hi,
I want to read a live log file line by line and considering those line which start from time stamp;
Below code I am using, which read line but throws an exception when comparing line that does not contain error code
tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies
10. Shell Programming and Scripting
Hi Folks,
I have the below csv file which is comma delimited , now from this file i need to read the value of the column der_id and then want to create a separate text file which will contain the value of the column der_id only please advise how to read the value of the column der_id and then... (3 Replies)
Discussion started by: punpun66
3 Replies
LEARN ABOUT PHP
mb_strcut
MB_STRCUT(3) 1 MB_STRCUT(3)
mb_strcut - Get part of string
SYNOPSIS
string mb_strcut (string $str, int $start, [int $length = NULL], [string $encoding = mb_internal_encoding()])
DESCRIPTION
mb_strcut(3) extracts a substring from a string similarly to mb_substr(3), but operates on bytes instead of characters. If the cut position
happens to be between two bytes of a multi-byte character, the cut is performed starting from the first byte of that character. This is
also the difference to the substr(3) function, which would simply cut the string between the bytes and thus result in a malformed byte
sequence.
PARAMETERS
o $str
- The string being cut.
o $start
- Starting position in bytes.
o $length
- Length in bytes. If omitted or NULL is passed, extract all bytes to the end of the string.
o $encoding
-The $encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
RETURN VALUES
mb_strcut(3) returns the portion of $str specified by the $start and $length parameters.
SEE ALSO
mb_substr(3), mb_internal_encoding(3).
PHP Documentation Group MB_STRCUT(3)