Converting text to certain format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Converting text to certain format
# 8  
Old 11-16-2010
I kinda like this:

Code:
echo "EDW_WHOLESALE_VORTEX" | perl -pe 's/([a-zA-Z])/[\u$1\l$1]/g'
[Ee][Dd][Ww]_[Ww][Hh][Oo][Ll][Ee][Ss][Aa][Ll][Ee]_[Vv][Oo][Rr][Tt][Ee][Xx]

TMTOWTDI!

Nathan
# 9  
Old 11-16-2010
Nice, this will also work in GNU sed:
Code:
sed 's/[[:alpha:]]/[\u&\l&]/g'

# 10  
Old 11-16-2010
I like the gnu sed even better.. very simple and clean
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting another line to another format

Hi there, How can i shorten this: grep -ri "Password must meet complexity requirements" "$line" | sed 's/\t/<\/td><td>/' | sed 's/^.*:/<tr><td>/'| sed 's/$/<\/td><\/tr>/' I am looking for a shorter alternative of sed. What I was trying to do is to change the string output format from ... (3 Replies)
Discussion started by: alvinoo
3 Replies

2. Shell Programming and Scripting

Need help in converting the file format

Hi All, I need help in converting the mentioned file format into desired output format using awk. Could anyone help me in this? Below is the input.. Date Account Campaign AdGroup Keyword Conversion Revenue Var1 Var2 Var3 Var4 Var5 10 20 30 ... (8 Replies)
Discussion started by: Ravi S M
8 Replies

3. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

4. Shell Programming and Scripting

Format problem while converting text file to csv

Hi , I need a help in following scenario.I tried searching in google but couldn't able to find the exact answer. Sorry if i am re-posting already answered query. While i am trying to convert into log file into csv i couldn't able to get the format which i am looking for. I converted file... (4 Replies)
Discussion started by: varmas424
4 Replies

5. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

6. Shell Programming and Scripting

Converting file format

My input file is Pipe delimited with 10 fields, I am trying to create a tab delimited output file with 6 fields from the provided input file. Below is sample data Input file abc||2|PIN|num||||www.123.com|abc@123.com| bcd||2|PIN|num|||||abc@123.com|... (3 Replies)
Discussion started by: pasupuleti81
3 Replies

7. Shell Programming and Scripting

Sybase Interface file and converting in text format.

Does anyone knows how to decode the address in interface file using shell , i have done it using perl but can it be done in shell. master tli tcp /dev/tcp \x00021004ac1414230000000000000000 query tli tcp /dev/tcp \x00021004ac1414230000000000000000 (0 Replies)
Discussion started by: dinjo_jo
0 Replies

8. Shell Programming and Scripting

converting text to csv format

I am trying to check each line and based on first two digits, the comma needs to be place. I checked in the earlier post where the text is converted to csv with a tab delimited. Here is the test file that needs to be changed to csv 11 051701 22 051701 330123405170105170112345... (13 Replies)
Discussion started by: gthokala
13 Replies

9. UNIX for Advanced & Expert Users

converting PDF to text, rtf doc format

Hi all Is there any program which can convert PDF to word processor file ? If the PDF has smart quotes, bullet icons, copyright and trademark symbols, etc. what happens to them intext format? So ideally would like to conver into rtf or doc. Thanks SS (1 Reply)
Discussion started by: saurya_s
1 Replies
Login or Register to Ask a Question