Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support Read file and change a 0 to a 1 in output Post 302358067 by glev2005 on Thursday 1st of October 2009 09:21:17 AM
Old 10-01-2009
I mean that I need it to check for the lines that I mentioned
<key>ExcludeSimpleHostnames</key>
<integer>1</integer>
In every section that starts with <key>Proxies</key>

and if it doesn't exist there to place it there the line after </array>

I want it to write this info to the file, not to create a new one.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read file and output message

hi, I have a baby.txt file with two type of message: xxxxxxxx is missing xxxxxxxxxxx is not missing xxxx is missing xxxxxxxx is not missing xxxxxxxx is not missing For the above, I need to read file and get all "xxxx is missing" and write into baby_missing.txt. If no message "xxxxx is... (12 Replies)
Discussion started by: happyv
12 Replies

2. Shell Programming and Scripting

Change output if file is empty

I'm very new to writing scripts, so here is my problem...I have the following code already written (in perl) system "rm file2"; open(FILE2, ">file2"); open(MYINPUTFILE, "file"); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); print file2 "$line\n"; print... (2 Replies)
Discussion started by: ddrew78
2 Replies

3. Shell Programming and Scripting

Change file output format

I have a file which has following contents usmtnz-dinfsi19 62 61 18400 18800 99.7 usmtnz-dinfsi19 62 61 18400 18800 99.7 i want the o/p to be like date (7 Replies)
Discussion started by: fugitive
7 Replies

4. Shell Programming and Scripting

How to read file and only output certain content

Hi - I have a file containing data like :- cn=tommy,cn=users,c=uk passwordexpirydate=20100530130623z cn=jane,cn=users,c=uk passwordexpirydate=20100423140734z cn=michael,cn=users,c=uk passwordexpirydate=20100331020044z I want to end up with a file that looks like:-... (6 Replies)
Discussion started by: sniper57
6 Replies

5. UNIX for Dummies Questions & Answers

How to read entire output from a file?

Hello- I am trying to view a file which is quite large. However, whenever I do 'cat (file name)' it shows me just the half.. I am using Putty to access my server. Also, is it possible to edit a file from a unix system on a 'Gedit for Windows" text editor? Thanks (7 Replies)
Discussion started by: DallasT
7 Replies

6. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

7. Shell Programming and Scripting

Bash Script Help...search then read from file: change text and pipe back...

Hello, I am trying to make a bash script that can pull data from a file and then change one part of said data. I want to search by username and pull the full line. That way there is a way to replace just one part of that line then return it back to the file. My Data is stored like: ... (1 Reply)
Discussion started by: serverfull
1 Replies

8. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

9. Shell Programming and Scripting

Change the naming convention of the output file

Hi Currently we have nmon running on our Red hat Linux server. The ouput file is now coming with the naming convention as "servername_160321_0010.nmon". The output file naming convention has to be changed as "nmon_servername_daily_2016.03.21_00.00.00" How can we do it ? Any suggestions... (10 Replies)
Discussion started by: newtoaixos
10 Replies

10. Shell Programming and Scripting

Read a lis, find items in a file from the list, change each item

Hello, I have some tab delimited text data, file: final_temp1 aname val NAME;r'(1,) 3.28584 r'(2,)<tab> NAME;r'(3,) 6.13003 NAME;r'(4,) 4.18037 r'(5,)<tab> You can see that the data is incomplete in some cases. There is a trailing tab after the first column for each incomplete row. I... (2 Replies)
Discussion started by: LMHmedchem
2 Replies
TM::FAQ(3pm)						User Contributed Perl Documentation					      TM::FAQ(3pm)

NAME
TM::FAQ - Topic Maps, Frequently Angering Quirks FAQ, TIPS AND PITFALLS o Q: I am using MLDBM as persistent store and the larger the map grows the MUCH slower insertions become. A: The way MLDBM works is that at every access (read or write) a large portion of the map is loaded via DBM into memory (and written back). One option is to avoid needpin-like modifications and to exploit the fact that many routines accept lists as parameters. So DO NOT do this: for some changes { $tm->assert ( one change ); } But DO that: $tm->assert ( map { one change $_ } some changes ); Similar with topic changes. Another option is to use a second, in-memory map for additions and then "add" the modifications to the MLDBM based map: my $updates = new TM; $updates->internalize .... $updates->assert .... $dbm->add ($updates); o Q: I am using MLDBM as persistent store and receive very strange errors which indicate that the map is empty. A: You could be dealing with a sitation that the DBM file already exists, but is completely empty (maybe because tmpnam created it). This has been fixed in v1.54. o Q: How can I get rid of these annoying topics "occurrence", "name", etc. which I have not put into the map in the first place. They seem to be in each map I create. A: These infrastructure topics are needed to make the map complete (everything used is defined). Per se, you cannot remove them and, seriously you probably do not want that to happen. But you can filter these out when you retrieve a list of toplets: my @ts = $tm->toplets ( '+all -infrastructure'); o Q: How can I get all names and/or occurrences of a topic? A: If you have a topic identifier "mytopic" in your hand, then you can get all characteristics (= names and occurrences, but not associations) with my @cs = $tm->match_forall (char => 1, irole => $tm->tids ('mytopic')); Then you can filter occording the type, the scope, the data type value or the "KIND". The latter tells you whether an assertion is a name or occurrence. For example those occurrences which are "occurrence"s and not anything specials as, say, "homepage": my @occs = map { $_->[0] } map { TM::get_x_players ($tm, $_, 'value') } grep { $_->[TM->TYPE] eq 'occurrence' } @cs; o Q: Some of these maps I create have the trait "ResourceAble" and import therefore a method "mtime". How does this work? A: Every map which is attached to an external resource is said to be resourceable, hence the trait with the same name. You, the developer, decide which copy of the map is the authoritative, i.e. what should happen should the map infrastructure be forced to synchronize the content. While the synchronization (and when that is triggered) is handled by the trait TM::Synchronizable, the infrastructure needs to know (a) when the in-memory copy of the map was last modified and (b) when the resource to which it is attached has been modified last. This is the reasons for timestamps on the memory-stored map. The resources themselves also have these timestamps; when the resource is a file on a file system, then the "last modified" timestamps are take from there. The only complication is that TM is using a much higher time resolution as most file systems (HiRes::Time). o Q: When using AsTMa (1.x) it is very difficult to figure out where I make a syntax error. Is there a convenient and effective way? What about line numbers? A: One approach is to use the %cancel method: When added to the file, the parser will stop there and write a message onto STDERR. Another method is to use "%trace 1" within the AsTMa stream. Then the parser should let you know what it could detect successfully. Line numbers cannot be used because the file will be massively reduced before the parser actually sees it. o Q: When serializing large maps, the serializer is REALLY slow. How to make it faster? A: The problem was that some serializers have to call the method "is_reified" very often to find out whether there is a reification for the assertion. If this becomes a concern to you, simply add an index over reification (available since 1.53): use Class::Trait; Class::Trait->apply ($tm, 'TM::Serializable::XTM'); use TM::Index::Reified; my $idx = new TM::Index::Reified ($tm, closed => 1); print $tm->serialize; COPYRIGHT AND LICENSE
Copyright 20(0[3-68]|10) by Robert Barta, <drrho@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-07 TM::FAQ(3pm)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy