Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check if last char in a line is '.' and if not, insert it Post 302440221 by pxalpine on Monday 26th of July 2010 01:47:04 PM
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??
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
GFFINDXMLATTR(1)														  GFFINDXMLATTR(1)

NAME
gffindxmlattr - Find XML extended attributes by XPath query SYNOPSIS
gffindxmlattr [ -d depth ] [ -F delim ] [ XPath | -f XPath-file ] path DESCRIPTION
gffindxmlattr finds XML extended attributes by a specified XPath expression, and displays path names and the corresponding XML extended attribute names. When a file is specified, XML extended attributes associated to the file are searched if there is the read permission. When a directory is specified, files or directories within the depth are recursively searched. When 0 is specified for the depth, the specified directory is searched. If the depth is not specified, all files and directories under the specified directory are searched. If the negative value is specified, gffindxmlattr returns error. Directories that do not have execute permission cannot be searched. gffindxmlattr displays path names and the corresponding XML extended attribute separated by the delim. OPTIONS
-d depth specifies the depth to be searched recursively. -F delim specifies a delimiter that separates the path name and the XML extended attribute name. By detault, the delimiter is TAB. -f XPath-file specifies a file that contains XPath expression. -? displays usage. SEE ALSO
gfxattr(1) Gfarm 18 August 2009 GFFINDXMLATTR(1)
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy