I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want.
The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
I was trying to simplify this from what I'm actually doing, but I started getting even more confused so I gave up. Here is the content of my input file:
Academic year,Term,Course name,Period,Last name,Nickname
2012-2013,First Semester,English 12,7th Period,Davis,Lucille
When I do this:
... (3 Replies)
My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records.
Note : here record delimter also \n
sample Source file with 6 fields :
1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n
... (6 Replies)
Dear All,
could you please help me to remove \n characters after all other replacements have been done as in the code below:
{
#remove punctuation and starting whitespaces
gsub("]"," ");
$1=$1;
}
{
#print lines containing 'whatever'
if ($1=="whatever")
{print}
#print... (3 Replies)
Hi All,
I am looking for an awk script to do the following
Join the fields together only if the first 4 fields are same.
Can it be done with join function in awk??
a,b,c,d,8,,,
a,b,c,d,,7,,
a,b,c,d,,,9,
a,b,p,e,8,,,
a.b,p,e,,9,,
a,b,p,z,,,,9
a,b,p,z,,8,,
desired output:
... (1 Reply)
Hi experts,
I need to print the first field first then last two fields should come next and then i need to print rest of the fields.
Input :
a1,abc,jsd,fhf,fkk,b1,b2
a2,acb,dfg,ghj,b3,c4
a3,djf,wdjg,fkg,dff,ggk,d4,d5
Expected output:
a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Hi All,
I receive a | delimited text file containing 63 columns. There is no delimiter at the end of the 63rd field, instead there would be a newline character at the end of the text in 63rd column. I wanted to retain this newline character at the end of the 63rd column, as it is desired newline... (1 Reply)
Hi
I have a file as below
<field1> <field2> <field3> ... <field_num1> <field_num2>
Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields.
I tried this and it doesn't sort on the difference field .. Appreciate your help.
cat... (9 Replies)
Discussion started by: newstart
9 Replies
LEARN ABOUT SUSE
pdl::char
Char(3) User Contributed Perl Documentation Char(3)NAME
PDL::Char -- PDL subclass which allows reading and writing of fixed-length character strings as byte PDLs
SYNOPSIS
use PDL;
use PDL::Char;
my $pchar = PDL::Char->new( [['abc', 'def', 'ghi'],['jkl', 'mno', 'pqr']] );
$pchar->setstr(1,0,'foo');
print $pchar; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'foo' 'ghi']
# ['jkl' 'mno' 'pqr']
# ]
print $pchar->atstr(2,0);
# Prints:
# ghi
DESCRIPTION
This subclass of PDL allows one to manipulate PDLs of 'byte' type as if they were made of fixed length strings, not just numbers.
This type of behavior is useful when you want to work with charactar grids. The indexing is done on a string level and not a character
level for the 'setstr' and 'atstr' commands.
This module is in particular useful for writing NetCDF files that include character data using the PDL::NetCDF module.
FUNCTIONS
new
Function to create a byte PDL from a string, list of strings, list of list of strings, etc.
# create a new PDL::Char from a perl array of strings
$strpdl = PDL::Char->new( ['abc', 'def', 'ghij'] );
# Convert a PDL of type 'byte' to a PDL::Char
$strpdl1 = PDL::Char->new (sequence (byte, 4, 5)+99);
$pdlchar3d = PDL::Char->new([['abc','def','ghi'],['jkl', 'mno', 'pqr']]);
string
Function to print a character PDL (created by 'char') in a pretty format.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['jkl' 'mno' 'pqr']
# ]
# 'string' is overloaded to the "" operator, so:
# print $char;
# should have the same effect.
setstr
Function to set one string value in a character PDL. The input position is the position of the string, not a character in the string. The
first dimension is assumed to be the length of the string.
The input string will be null-padded if the string is shorter than the first dimension of the PDL. It will be truncated if it is longer.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
$char->setstr(0,1, 'foobar');
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['foo' 'mno' 'pqr']
# ]
$char->setstr(2,1, 'f');
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['foo' 'mno' 'f'] -> note that this 'f' is stored "f "
# ]
atstr
Function to fetch one string value from a PDL::Char type PDL, given a position within the PDL. The input position of the string, not a
character in the string. The length of the input string is the implied first dimension.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
print $char->atstr(0,1);
# Prints:
# jkl
perl v5.12.1 2009-10-17 Char(3)