Check if last char in a line is '.' and if not, insert it


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Check if last char in a line is '.' and if not, insert it
Prev   Next
# 1  
Old 07-26-2010
Check if last char in a line is '.' and if not, insert it

Hi all,

I've searched for this but couldn't seem to find the answer I'm looking for. I have a text file that looks like this:

sgea0447 Earnings followed the same path. earnings followed the same path
sgea0448 Economic growth slowed further. economic growth slowed further
sgea0449 Emergency vehicles flash red or red blue. emergency vehicles flash red or red blue.
sgea0450 Encourage someone who is in low spirits. encourage someone who is in low spirits,
sgea0451 Enter the corporate raider. enter the corporate raider,
sgea0452 Entertaining leaves you feeling relaxed. entertaining leaves you feeling relaxed
sgea0453 Especially by your wife. especially by your wife,

As you can see, the last character of each line either already has a period, or it has commas, or it just has no punctuation. What I want is for all the lines to have a period at the end, should look like this:

sgea0447 Earnings followed the same path. earnings followed the same path.
sgea0448 Economic growth slowed further. economic growth slowed further.
sgea0449 Emergency vehicles flash red or red blue. emergency vehicles flash red or red blue.
sgea0450 Encourage someone who is in low spirits. encourage someone who is in low spirits.
sgea0451 Enter the corporate raider. enter the corporate raider.
sgea0452 Entertaining leaves you feeling relaxed. entertaining leaves you feeling relaxed.
sgea0453 Especially by your wife. especially by your wife.

Can anyone help??
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search a certain char and insert new text if a match found

Have a file which has the create statement like below create table emp ( empno integer, empname char(50)) primary index(empno); i need to find a string starting with create and ends with semi-colon ;. if so insert the below statement before create statement rename table emp to emp_rename;... (2 Replies)
Discussion started by: Mohan0509
2 Replies

2. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

3. Shell Programming and Scripting

How to separate one line to mutiple line based on one char?

Hi Gurus, I need separate one file which is one huge line to mutiple line. file like abcd # bcd # def # fge # ged I want to get abcd bcd def fge ged Thanks in advance (4 Replies)
Discussion started by: ken6503
4 Replies

4. Shell Programming and Scripting

Formatting File having big single line into 95 Char Per Line

Hi All, I have 4 big files which contains one big line containing formatted character records, I need to format each file in such way that each File will have 95 Characters per line. Last line of each file will have newline character at end. Before:- File Name:- File1.dat 102 121340560... (10 Replies)
Discussion started by: lancesunny
10 Replies

5. Shell Programming and Scripting

Insert carriage return on the 10th char position of each line

Hi experts, Need your help on how to insert carriage return after the 10th char position of each line in a file and then add two blank spaces after the carriage return. Example: >cat test.txt testingline dummystring samplesample teststringline Expected output should be.. ... (2 Replies)
Discussion started by: brichigo
2 Replies

6. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

7. Shell Programming and Scripting

how first char in odd line and second char in even line

Hi I m having ifconfig -a o/p like sbanlab1:ksh# ifconfig -a | egrep "flags|inet" | awk -F' ' '{print $1,$2}' lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 bge0:... (1 Reply)
Discussion started by: tarunn.dubeyy
1 Replies

8. Shell Programming and Scripting

How to insert a char in every two?

Hi, I've written a script to interrogate all fibre devices on our systems and output the WWNs to a file. I now want to insert a ":" every 2 characters into the WWN so I can write another script to create aliases within the SAN. So the current file has WWNs in the following format;... (2 Replies)
Discussion started by: h8mmer
2 Replies

9. UNIX for Dummies Questions & Answers

unable to insert '#' char for a file in vi mode

Hi all, I am very new to this forum and also new to UNIX. I am working on HP-UX machine. I noticed that for some of the users I am unable to insert the # character in a file in vi mode. May I know y am I having the problem and how can I resolve this Thanks, Maroli (1 Reply)
Discussion started by: maroli
1 Replies

10. Shell Programming and Scripting

How to check a column contain numeric or char data type ??

I have a file called clientname_filename.csv whose contents are like col1|col2|col3|col4| 510|abc|xxx|450| 510|abc11|yyy|350 510|pqr99|zzz| 670 512|222|439|110 Here i have check the contents of column for data type. i have a constraints that col1 always contain Numeric value column 2... (12 Replies)
Discussion started by: jambesh
12 Replies
Login or Register to Ask a Question
af_history(3)						    Attribute Filesystem (AtFS) 					     af_history(3)

NAME
af_histories, af_access - AtFS history functions SYNOPSIS
#include <atfs.h> char**af_histories (char *path, char *pattern) char**af_cachenames (char *path, char *pattern); int af_access (char *path, char *name, char *type, int mode) DESCRIPTION
af_histories returns a list of source history names from the directory pointed to by path, that match the given pattern. Histories in a directory are represented by at least one version. The pattern must be ed(1) patterns, processable by re_comp(3) and re_exec(3). The resulting list of af_histories resides in allocated memory. Use free(3) to free the memory for further allocation. af_histories returns an empty list (not a NULL pointer !), when no histories are found. af_cachenames does the same as af_histories but on derived object caches. af_access determines the existence of an object history. If any ASO (any version) with the given path, name and type attributes exists, af_access returns zero, otherwise -1. The mode argument can either be AF_CLASS_SOURCE indicating that only source objects shall be searched or AF_CLASS_DERIVED which means that only the derived object cache shall be searched for existence of a matching ASO. SEE ALSO
ed(1), re_comp(3), re_exec(3), free(3) DIAGNOSTICS
Upon error, -1 or a null pointer (depending on the return type) is returned and af_errno is set to the corresponding error number. AtFS-1.71 Fri Jun 25 14:33:09 1993 af_history(3)