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>
<expected file>
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"
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.
---------- Post updated at 02:39 PM ---------- Previous update was at 02:16 PM ----------
Ctsgnb,
Your solution worked great without replacing the other text. Now how to make this work for another pattern lets say if the text contains a line as below -
2837 Opera Singers wanted to adjust the reecho clarity on 3747
In the above line, I have adjust and want to incorporate that into this line here below and I cant seem to do it.
Please help.
Also, strangely enough, Im seeing some of the old text along with the newly replaced text as well. I dont know how to go about this now. I only tested part of the file in the morning and now, when I run this on the entire, Im seeing all of these new errors.
---------- Post updated at 04:46 PM ---------- Previous update was at 02:39 PM ----------
Ctsgnb,
Can you please tell me as how do I add another conditional check in here so as to increase the scope of what you wrote in here ?
thanks,
PGonzalez
Last edited by Scott; 03-01-2011 at 06:12 PM..
Reason: Code tags
Since it matches none of the 4 conditions defined, what do you want :
1) since it match none of the 4 previous conditions, you want just to skip it ?
2) since it match none of the 4 previous conditions, you want just to display it ?
3) You want to add the 5th condition (which one ? ) ... to replace it with for example:
if the input is
please let me know which output you need.
Please give more clue about what input you have and what output you expect.
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)
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)
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)
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)
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)
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)
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)