Sponsored Content
Full Discussion: Help for File Modification
Top Forums Shell Programming and Scripting Help for File Modification Post 302598335 by mnmonu on Tuesday 14th of February 2012 06:08:57 AM
Old 02-14-2012
Help for File Modification

Hi All, I have a file. This file contain huge amount of data. I want to modify this file. I want enter new line when count of "~ character is 79. Please find below the code : cat file_name | tr -d '\n' | sed 's/\([^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~[^~]*"~\)/\1\n/g' > new_filename This code is working. But sometime problem, not count properly. Please help me. Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File modification time

Does anyone know how to display the time with seconds of when a file was last modified. I can get hour & minutes but would also like seconds. --Running AIX (1 Reply)
Discussion started by: edog
1 Replies

2. Shell Programming and Scripting

File modification

Dear all, i have a file which contains this lines. 0-0 CC=1 0-01 0-011 0-0111 0-01110 F=500 CC=1 L=15 M=5 TRD=3948... (2 Replies)
Discussion started by: panknil
2 Replies

3. UNIX for Dummies Questions & Answers

How to change the file modification time of a file on nfs mount point

Hi I am accessing a file on nfs mounted device, after completing using of the file, i am tring to restore the access time and modification times of the file. So i got the previous modified time of the file using stat() function and trying to set the date and time for the file, To set these... (6 Replies)
Discussion started by: deepthi.s
6 Replies

4. Shell Programming and Scripting

File modification history

Can anyone please suggest an alternate command for "stat" . I am trying this on Solaris 5.9 , but the command doesn't exist. Basically i need to see one particalar file modification history. Any help is appreciated. (4 Replies)
Discussion started by: mk1216
4 Replies

5. Shell Programming and Scripting

Help with file modification

Hi, I have a file test.txt . The contain of the file is as below : 365798~SAPUS~PR5~0000799005~ADM CHARG MEDCAL INS~~~~~~~~~~~~~~~~~~~~~~~~SLAC480 I want to modify this file. And file contain loking like "365798"~"SAPUS"~"PR5"~"0000799005"~"ADM CHARG MEDCAL... (6 Replies)
Discussion started by: mnmonu
6 Replies

6. Shell Programming and Scripting

Help for File Modification

Hi, I have a file abcd.txt. cat abcd.txt output is as follows : "aa"~"bb"~"001"~""~""~"cc" "dd"~"005"~"" ~""~"kk"~"aa"~"00 8"~""~""~ I want the output looking like: cat abcd.txt "aa"~"bb"~"001"~""~""~ "cc""dd"~"005"~""~""~ "kk"~"aa"~"008"~""~""~ I have a script. (4 Replies)
Discussion started by: mnmonu
4 Replies

7. Shell Programming and Scripting

Help for File Modification

Hi All, I have a file disk_space.log. cat disk_space.log 94% / 32% /boot 38% /mnt/data 100% /media/CDROM I want the output, like cat disk_space.log 94% / 100% /media/CDROM That means print the line those are grater-than 90%. And rest of the line is remove from file. I have a... (2 Replies)
Discussion started by: mnmonu
2 Replies

8. Shell Programming and Scripting

File Modification

Hi, I have a file input.txt. cat input.txt output is as follows : Code: "0001"~"name"~"bb"~"20.25"~""~""~"0002"~"name" "dd"~"35.50"~"" ~""~"0003"~"name"~"aa"~"21.3 5"~""~""~ I want the output looking like: cat output.txt Code: "0001"~"name"~"bb"~"20.25"~""~""~... (6 Replies)
Discussion started by: mnmonu
6 Replies

9. Programming

File content modification

HI All, I have a file with content as below Filename: my name is xyz my name abc my name is bdf end Filename: my name uvx my name edd my name jhn end i want to edit the content and save into another file as Filename1: my name is xyz Filename1: my name abc Filename1: my name is... (4 Replies)
Discussion started by: jhon1257
4 Replies

10. Shell Programming and Scripting

Help For File modification

Hi, I have a file. File contains are as follows : Feb 19, 2012 5:05:00 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Feb 19, 2012 5:05:00 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 771 ms Feb 20, 2012... (3 Replies)
Discussion started by: mnmonu
3 Replies
memory(n)						       Tcl Built-In Commands							 memory(n)

__________________________________________________________________________________________________________________________________________________

NAME
memory - Control Tcl memory debugging capabilities SYNOPSIS
memory option ?arg arg ...? _________________________________________________________________ DESCRIPTION
The memory command gives the Tcl developer control of Tcl's memory debugging capabilities. The memory command has several suboptions, which are described below. It is only available when Tcl has been compiled with memory debugging enabled (when TCL_MEM_DEBUG is defined at compile time), and after Tcl_InitMemory has been called. memory active file Write a list of all currently allocated memory to the specified file. memory break_on_malloc count After the count allocations have been performed, ckalloc outputs a message to this effect and that it is now attempting to enter the C debugger. Tcl will then issue a SIGINT signal against itself. If you are running Tcl under a C debugger, it should then enter the debugger command mode. memory info Returns a report containing the total allocations and frees since Tcl began, the current packets allocated (the current number of calls to ckalloc not met by a corresponding call to ckfree), the current bytes allocated, and the maximum number of packets and bytes allocated. memory init [on|off] Turn on or off the pre-initialization of all allocated memory with bogus bytes. Useful for detecting the use of uninitialized val- ues. memory objs file Causes a list of all allocated Tcl_Obj values to be written to the specified file immediately, together with where they were allo- cated. Useful for checking for leaks of values. memory onexit file Causes a list of all allocated memory to be written to the specified file during the finalization of Tcl's memory subsystem. Useful for checking that memory is properly cleaned up during process exit. memory tag string Each packet of memory allocated by ckalloc can have associated with it a string-valued tag. In the lists of allocated memory gener- ated by memory active and memory onexit, the tag for each packet is printed along with other information about the packet. The mem- ory tag command sets the tag value for subsequent calls to ckalloc to be string. memory trace [on|off] Turns memory tracing on or off. When memory tracing is on, every call to ckalloc causes a line of trace information to be written to stderr, consisting of the word ckalloc, followed by the address returned, the amount of memory allocated, and the C filename and line number of the code performing the allocation. For example: ckalloc 40e478 98 tclProc.c 1406 Calls to ckfree are traced in the same manner. memory trace_on_at_malloc count Enable memory tracing after count ckallocs have been performed. For example, if you enter memory trace_on_at_malloc 100, after the 100th call to ckalloc, memory trace information will begin being displayed for all allocations and frees. Since there can be a lot of memory activity before a problem occurs, judicious use of this option can reduce the slowdown caused by tracing (and the amount of trace information produced), if you can identify a number of allocations that occur before the problem sets in. The current num- ber of memory allocations that have occurred since Tcl started is printed on a guard zone failure. memory validate [on|off] Turns memory validation on or off. When memory validation is enabled, on every call to ckalloc or ckfree, the guard zones are checked for every piece of memory currently in existence that was allocated by ckalloc. This has a large performance impact and should only be used when overwrite problems are strongly suspected. The advantage of enabling memory validation is that a guard zone overwrite can be detected on the first call to ckalloc or ckfree after the overwrite occurred, rather than when the specific memory with the overwritten guard zone(s) is freed, which may occur long after the overwrite occurred. SEE ALSO
ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG KEYWORDS
memory, debug Tcl 8.1 memory(n)
All times are GMT -4. The time now is 10:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy