Sponsored Content
Contact Us Post Here to Contact Site Administrators and Moderators How to read the nth character from the line.? Post 303009744 by Scott on Tuesday 19th of December 2017 10:22:02 AM
Old 12-19-2017
For the last time, please do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
This User Gave Thanks to Scott For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read First Character of Each Line in File

I need a better way to read the first character of each line in a file and check if it equals the special character ¤. This character tells me where there is a break in the reports. The file has over 500,000 lines. Currently, this is my code - if ] I am using Korn Shell as a scripting... (7 Replies)
Discussion started by: azelinsk
7 Replies

2. Shell Programming and Scripting

Read line based on character,

Hi Experts, I have called file1.txt contains below CREATE TABLE "IHUBDEV2"."TLM_BREAK_RULES" ( "OID" VARCHAR2(32) NOT NULL ENABLE, "TLM_PAY_CLASS_OID" VARCHAR2(32) NOT NULL ENABLE, "PUNCHED_BREAKS" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE, "NORMAL_BREAKS"... (3 Replies)
Discussion started by: naree
3 Replies

3. Shell Programming and Scripting

Read last word of nth line

Hi people; i want to read the last word of the 14th line of my file1.txt. Here is the EXACT 14th line of the file. 250 SectorPortnum=3,AuxPortInUngo=2,PortDeviceGroup=1,PortDeviceSet=1,PorDevice=1 20 >>> Set. i have to get the word Set. how can i call it and also how... (3 Replies)
Discussion started by: gc_sw
3 Replies

4. Shell Programming and Scripting

How to read one character form each line of the file?

Hi, Maybe this iscorrect forum for my question... I should read one character at a fixed position from each line of the file. So how ??? should be substituted in the code below: while read line ; do single_char=`???` echo "$single_char" done < $input_file OK...I did get an... (0 Replies)
Discussion started by: arsii
0 Replies

5. Shell Programming and Scripting

Read file from nth line to specific character

Hi, I want to read the file from nth line (where n is an integer) to until I encounter @ char. Can any one please help me how to do this? Thanks. (3 Replies)
Discussion started by: laalesh
3 Replies

6. Shell Programming and Scripting

Calculating average for every Nth line in the Nth column

Is there an awk script that can easily perform the following operation? I have a data file that is in the format of 1944-12,5.6 1945-01,9.8 1945-02,6.7 1945-03,9.3 1945-04,5.9 1945-05,0.7 1945-06,0.0 1945-07,0.0 1945-08,0.0 1945-09,0.0 1945-10,0.2 1945-11,10.5 1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

7. Shell Programming and Scripting

Read a file from the nth line on

I have a script which reads from a job file and executed the scripts in the job file in sequence. #! /bin/ksh set -x while read line do $line.ksh if # mail the team fi done <"$file" The job file will be like abcd efgh ijkl mnop qrst This is working fine. I need to add... (2 Replies)
Discussion started by: nw2unx123
2 Replies

8. Shell Programming and Scripting

Search and recursively enter new line after Nth character

Hi All, My file is a string of around 50K character. I'm trying to insert new line after every 320 character in my file. I know the command to insert newline, but problem is I'm not able to search 320th position. Please advice. (6 Replies)
Discussion started by: Amit786
6 Replies

9. Shell Programming and Scripting

Read character by character in line in which space is also included

Hi friend, I have one file , and i want to read that file character by character. I need this script in ksh. while using read option with -n1 am getting error. while read -n1 c read has bad option And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 Replies

10. Shell Programming and Scripting

Replace nth to nth character?

Hi I got the following problem and I wonder if some could please help me out? I'd like to replace character 8 - 16 , 16 - 24 cat file ... (2 Replies)
Discussion started by: stinkefisch
2 Replies
TM::Index::Match(3pm)					User Contributed Perl Documentation				     TM::Index::Match(3pm)

NAME
TM::Index::Match - Topic Maps, Indexing support (match layer) SYNOPSIS
# somehow get a map (any subclass of TM will do) my $tm = ... # one option: create a lazy index which learns as you go use TM::Index::Match; my $idx = new TM::Index::Match ($tm); # for most operations which involve match_forall to be called # reading and querying the map should be much faster # learn about some statistics, what keys are most likely to be useful my @optimized_keys = @{ $stats->{proposed_keys} }; # another option: create an eager index my $idx = new TM::Index::Match ($tm, closed => 1); # pre-populate it, use the proposed keys $idx->populate (@optimized_keys); # this may be a lengthy operation if the map is big # but then the index is 'complete' # query map now, should also be faster # getting rid of an index explicitly $idx->detach; # cleaning an index $idx->discard; DESCRIPTION
This index implements a generic query cache which can capture all queries not handled by more specific indices. This class inherits directly from TM::Index. INTERFACE
Constructor The constructor/destructors are the same as that described in TM::Index. Methods populate $idx->populate (@list_of_keys) To populate the index with canned results this method can be invoked. At this stage it is not very clever and may take quite some time to work its way through a larger map. This is most likely something to be done in the background. The list of keys to be passed in is a bit black magic. Your current best bet is to look at the index statistics method, and retrieve a proposed list from there: @optimized_keys = @{ $stats->{proposed_keys} }; $idx->populate (@optimized_keys[0..2]); # only take the first few If this list is empty, nothing clever will happen. statistics $hashref = $idx->statistics This returns a hash containing statistical information about certain keys, how much data is behind them, how often they are used when adding information to the index, how often data is read out successfully. The "cost" component can give you an estimated about the cost/benefit. SEE ALSO
TM, TM::Index COPYRIGHT AND LICENSE
Copyright 200[6] by Robert Barta, <drrho@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2008-04-10 TM::Index::Match(3pm)
All times are GMT -4. The time now is 07:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy