Sponsored Content
Full Discussion: Text Translation
Special Forums UNIX Desktop Questions & Answers Text Translation Post 302500753 by PG3 on Tuesday 1st of March 2011 12:08:47 PM
Old 03-01-2011
Text Translation

hi all,
Im a unix newbie and Im trying to find and replace text and I been looking at these posts since 7 am and I still dont see what Im
after.
Here is the task at hand. Im trying to translate few lines by doing cat <file> and here is what Im doing
<file>
Code:
20110228 Mike Original apartment costed almost 23277AA
20110130 And few of the upgrades alone were into few hundred thousand dollars 47738
20110219 BUT THAT WAs magical and everyone was so elated to see 93884
20110222 so would you want to join us 38488

<expected file>
Code:
20110228 TEXT1 23277AA
20110130 TEXT2 47738
20110219 TEXT3 93884
20110222 TEXT4 38488

in other words
if the line contains the word, original, then replace that entire text(only alphabets) line with "TEXT1"
if the line contains the word, dollars, then replace entire text with "TEXT2"
if the line contains the word, magical, then replace entire text with "TEXT3"
if the line contains the word, join, then replace entire text with "TEXT4"
Code:
cat <file> | awk '$0 ~/original/ { sub($0, "TEXT1"; print }'

but that is not working as I dont know what Im doing here.

Please help !

Thanks,
PGonzalez

Last edited by Scott; 03-01-2011 at 02:19 PM.. Reason: Please use code tags.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need translation?

Can someone tell me exactly what this code is doing? # # gnutest # # Test launch of ghostscript (gs) from a script # rm gnutest.ps # # ------- calculation that would generate file(s) to # be plotted with gnuplot would be placed here ----------- # gnuplot << \E-o-f2 set... (1 Reply)
Discussion started by: wmosley2
1 Replies

2. Programming

Swedish Character translation

Sorry if this been posted before. At the moment I'm having problem with the iscntrl() function. I need it to run a check on code entered into a Text Box, however I also need to allow the "Ö, ö" Swedish characters. The iscntrl() function seems to pick up the characters above as part of the... (0 Replies)
Discussion started by: rebelwassie
0 Replies

3. Shell Programming and Scripting

I need translation!

Someone give me info on this script. I put all the parts I do not understand in BOLD. Please someone explain what the parts in BOLD does/mean. Thanks! #!/bin/bash #Usage: cmdArgs.sh arg1 arg2 arg3 printf "The number of command line args is: $#\n" declare -i counter #Not strictly... (7 Replies)
Discussion started by: 801238429
7 Replies

4. UNIX for Dummies Questions & Answers

help --translation

I am reading the SANS security policy--.I want to translate the to Chinese.But I don`t understand a paragraph of the. It is :"Where SNMP is used, the community strings must be defined as something other than the standard defaults of "public," "private" and "system" and must be different from... (1 Reply)
Discussion started by: beijingzhzj
1 Replies

5. UNIX for Dummies Questions & Answers

AIX to HP-UX translation please

I have been looking up the allocated space, free space and the contents (raw, jfs, paging) of the logical volumes in AIX servers. I have been using lsvg and lsvg -l (server name). What is the HP-UX equivalent to that? I was given this command also so I would not have to type in each volume group... (2 Replies)
Discussion started by: compan023
2 Replies

6. AIX

Can't ping - IP translation issue?

Hello, Any help or advice on this would be greatly appreciated. I have a site-to-site VPN, across which data is synced between two CRM systems. The opposing side of this tunnel is a flat network (lets call it 201.200.156.xx/24) My internal network is a 192.168.0.xx/24 network, however before... (2 Replies)
Discussion started by: thruster9
2 Replies

7. IP Networking

Network address translation

How would one approach the problem of determining the NAT tables of a router without knowing the userid and password. The only password holder died. I know the internal ip address of the router is 192.168.2.1, and also ports 80 or 8080 and 3389 are open. (5 Replies)
Discussion started by: jgt
5 Replies
ACHECK.1(1)						User Contributed Perl Documentation					       ACHECK.1(1)

NAME
acheck - Check common localization mistakes SYNOPSIS
acheck [OPTIONS] [INPUT_FILE] DESCRIPTION
This program parses a file checking for syntax rules and optionally asking Aspell for checking word spelling. It makes fix suggestions and outputs a corrected file accordingly adding review comments if requested. It tries to find the file type according to the extension or the first lines and loads rules accordingly. It displays lines when they are parse. When an error is found, a menu is displayed. Just press Enter if you don't want to change anything. If a choice suits you, enter the corre- sponding number. If you want to fix it but no choice is correct, enter a space, then you will be asked for a string to replace the high- lighted text. The script will replace the highlighted text with your choice and parse it again for new errors. Here are all the available commands: Enter, ignore. Ignore. Ctrl+L, redraw. Rewrite the last line, suggestions and hints. Space, edit. Edit the highlighted text. E, edit line. Edit the whole line. H, add hint. Add the displayed hint as review comment. Use this if you want the translator to see the corresponding warning or error but you have no correction. N, next line. Skip the rest of this line. X, exit and discard all changes. Quit without saving modifications, the script ask you for confirmation, you have to enter `yes' to exit otherwise parsing starts again at the current mistake. a, add in dictionary. Add the highlighted word to you personal dictionary, capitalized as it is. l, add lowercase in dictionary. Lowercase the highlighted word to add it to your personal dictionary. i, ignore word. Ignore the highlighted word, same as Enter. I, ignore all. Ignore the highlighted word and add it to your session dictionary. OPTIONS
Verbosity level: -q, --quiet quiet mode. -v verbose, start at level $Debug + 1, add more for more verbosity (see below). --verbose n set verbosity level to n (see below). Files: -i, --input input filename, can be '-' to read data from standard input. -o, --output output filename, can be '-' to write data to standard ouput. If no output filename is provided, input file is backed up with `bak_ext' extension and input filename is used. Spell check: -s, --spell check spelling with Aspell. -d language, --dict language use language dictionary for Aspell. -n, --nospell don't check spelling. Mode: -r, --review review mode, add comments on lines beginning with $Comment after parsed line. -t, --trans translator mode, don't add comments, just fix errors. others: --rules ruleset use ruleset rules set. --type filetype use filetype whatever the file type is. --dump Dump the rules to check and exit, use this for debugging purposes. -V, --version print version and exit. -h, --help print a short usage message and exit. Verbosity Level 0 quiet, normal only warnings and errors 1 debug names of subroutines 2 debug verbose names and arguments of subroutines 3 .. 5 debug very verbose output parsing and checking details SEE ALSO
acheck(5), acheck-rules(5) AUTHOR
Nicolas Bertolissio <bertol@debian.org> perl v5.8.4 2003-10-05 ACHECK.1(1)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy