Sponsored Content
Top Forums Shell Programming and Scripting Editing phone number with multiple delimiters Post 302770625 by Corona688 on Sunday 17th of February 2013 03:35:17 PM
Old 02-17-2013
BASH itself lets you use multiple characters as the delimiter without the help of sed and awk.

Code:
while IFS=" -" read JSD AAA BB CCCC G
do
        echo "First col $JSD"
        echo "Second col $AAA"
        echo "Third col $BB"
        echo "Fourth col $CCC"
        echo "Fifth and later cols $G"
done < "$1"

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count number of delimiters in a file name

I have a list of files with names as "FULL_abcd_xyz_timestamp.txt" and "FULL_xx_abcd_xyz_timestamp.txt". I am writing a script with a 'for loop' to take each file, strip the "FULL" and "timestamp" from the file name and do some actions on the contains of the file. So I need to know the number of... (4 Replies)
Discussion started by: ayanbiswas
4 Replies

2. UNIX for Dummies Questions & Answers

Script to find the number of tab delimiters in a line

Hi, I need to find the number of tab delimiters in the first line of a file.So using word=`head -1 files.txt` I have extracted the first line of file into a variable word.It has 20 tab delimted columns.So can anyone help me in finding the number of delimiters? I am using csh and I am a... (5 Replies)
Discussion started by: poornimajayan
5 Replies

3. Shell Programming and Scripting

Perl script :- Phone number validation

Hi All, I am doing a perl script validation for Phone numbers. The normal phone number format is 01-32145. I need to do two validations for the phone number 1) A valid phone number can have at least two digits as prefix and at least five digits as postfix. e.g. 01-01011 2) A... (5 Replies)
Discussion started by: subin_bala
5 Replies

4. Shell Programming and Scripting

AWK with multiple delimiters

I have the following string sample: bla bla bla bla bla I would like to extract the "123" using awk. I thought about awk -F"]" '{ print $1 }' but it doesn't work Any ideas ? (7 Replies)
Discussion started by: gdub
7 Replies

5. Shell Programming and Scripting

Sorting problem: Multiple delimiters, multiple keys

Hello If you wanted to sort a .csv file that was filled with lines like this: <Ticker>,<Date as YYYYMMDD>,<Time as H:M:S>,<Volume>,<Corr> (H : , M, S: ) by date, does anybody know of a better solution than to turn the 3rd and 4th colons of every line into commas, sorting on four keys,... (20 Replies)
Discussion started by: Ryan.
20 Replies

6. Shell Programming and Scripting

Concatinating the lines based on number of delimiters

Hi, I have a problem to concatenate the lines based on number of delimiters (if the delimiter count is 9 then concatenate all the fields & remove the new line char bw delimiters and then write the following data into second line) in a file. my input file content is Title| ID| Owner|... (4 Replies)
Discussion started by: bi.infa
4 Replies

7. Shell Programming and Scripting

Getting phone number, its message and assigning them into 2 variables then screen output.

Hi Everyone, I have a flatfile "inbox.txt" which contains some information: Location 0, folder "Inbox", SIM memory, Inbox folder SMS message SMSC number : "+24800000023" Sent : Sat 04 Aug 2012 09:01:00 PM +0700 Coding : Default GSM alphabet... (5 Replies)
Discussion started by: testcase
5 Replies

8. Shell Programming and Scripting

awk multiple delimiters

Hi Folks, This is the first time I ever encountered this situation My input file is of this kind cat input.txt 1 PAIXAF 0 1 1 -9 0 0 0 1 2 0 2 1 2 1 7 PAIXEM 0 7 1 -9 1 0 2 0 1 2 2 1 0 2 9 PAKZXY 0 2 1 -9 2 0 1 1 1 0 1 2 0 1 Till the sixth column (which is -9), I want my columns to... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

9. Shell Programming and Scripting

Count The Number Of Delimiters using awk or better

What to know the way to count the number of delimiters in each record by ignoring the escape delimiters. Sample Data: 12345678|ABN\|XYZ MED CHEM PTY. LTD.|C||100.00|22|AB"C\|Corp|"XYZ|CDEF"| I'm using awk -F'|' '{ print NF-1 }' command to find the number of delimiters. this command... (8 Replies)
Discussion started by: BrahmaNaiduA
8 Replies

10. Web Development

Auto phone number search

Hi. I want to search 10 phone numbers automatically in Facebook and store the result in some format. Can anyone help me with the script. I am using kali Linux. (2 Replies)
Discussion started by: looksthatmatter
2 Replies
CHFN(1) 						      Linux Reference Manual							   CHFN(1)

NAME
chfn - change your finger information SYNOPSIS
chfn [ -f full-name ] [ -o office ] [ -p office-phone ] [ -h home-phone ] [ -u ] [ -v ] [ username ] DESCRIPTION
chfn is used to change your finger information. This information is stored in the /etc/passwd file, and is displayed by the finger pro- gram. The Linux finger command will display four pieces of information that can be changed by chfn : your real name, your work room and phone, and your home phone. COMMAND LINE Any of the four pieces of information can be specified on the command line. If no information is given on the command line, chfn enters interactive mode. INTERACTIVE MODE In interactive mode, chfn will prompt for each field. At a prompt, you can enter the new information, or just press return to leave the field unchanged. Enter the keyword "none" to make the field blank. OPTIONS
-f, --full-name Specify your real name. -o, --office Specify your office room number. -p, --office-phone Specify your office phone number. -h, --home-phone Specify your home phone number. -u, --help Print a usage message and exit. -v, --version Print version information and exit. SEE ALSO
finger(1), passwd(5) AUTHOR
Salvatore Valente <svalente@mit.edu> chfn October 13 1994 CHFN(1)
All times are GMT -4. The time now is 12:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy