Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Cut paste from one file to other Post 302478896 by swapsb on Thursday 9th of December 2010 06:32:01 AM
Old 12-09-2010
Cut paste from one file to other

Hello,
I am working on unix for the first time.
I have to write a shell script where i want to cut paste from one file to other.

File "1234.abc" is
Code:
03,12345555
16,936,x,x,120
16,936,x,x,100
49,12345555
03,12347710
16,936,x,x,115
16,936,x,x,122
49,12347710
03,12342222
16,936,x,x,146
16,926,x,x,88
49,12342222

Here in "03,12345555", 03 indicates line id and 12345555 indicates account number of user. The subsiquent lines are details for account number 12345555 till record "49,12345555"
From next line, details for new account number eg.12347710 starts

My requirement is if i give parameter as 12347710, all records for this accounts should be cut from File "1234.abc" and should be pasted in new file "1234.7710" (ie name of original file and extn is last four digits of parameter)

so new "1234.abc" will be
Code:
03,12345555
16,936,x,x,120
16,936,x,x,100
49,12345555
03,12342222
16,936,x,x,146
16,926,x,x,88
49,12342222

and "1234.7710" will be
Code:
03,12347710
16,936,x,x,115
16,936,x,x,122
49,12347710


Last edited by Franklin52; 12-09-2010 at 08:05 AM.. Reason: Please use code tags, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cut & paste

hi i am new to shell scripting, i have been trying to cut columns numbered 1,4 of a file consisiting of 4 columns. Each column is seperated by 2 spaces. for example: john 6102097199 tennessee usa michel 6734590899 texas USA now, i need to cut the name... (3 Replies)
Discussion started by: t_harsha18
3 Replies

2. Shell Programming and Scripting

cut and paste?

hi, I have a file with content like this for an employee: EmployeeID 101 Day_type, day vacation,1/2/2009 sick day, 3/2/2009 personal day, 4/5/2009 jury duty day, 5/5/2009 how do I make the result to show: EmployeeID,Day_type,day 101,vacation,1/2/2009 101,sick day,... (6 Replies)
Discussion started by: jbchen
6 Replies

3. Shell Programming and Scripting

cut and paste

Hi, Need a help with shell script. I have to search for a string in one of the file, if match found, copy the line to a new file and delete the line from the exisiting file. eg: 83510000000000063800000.1800000.1600000.1600000.2400000.1800000.2000000.21... (6 Replies)
Discussion started by: gpaulose
6 Replies

4. UNIX for Dummies Questions & Answers

Need help with using cut and paste command

I have a file which contains 3 fields separated by tabs example andrew kid baker I need to swap kid and baker using cut and paste commands how is this to be done? Thanks (1 Reply)
Discussion started by: drew211
1 Replies

5. Shell Programming and Scripting

need help with cut and paste command

I have a file which contains 3 fields separated by tabs example andrew kid baker I need to swap kid and baker using cut and paste commands how is this to be done? Thanks (3 Replies)
Discussion started by: drew211
3 Replies

6. Shell Programming and Scripting

Help required the cut the whole contents from one file and paste it into new file

Hi, First of all sincere apologies if I have posted in a wrong section ! Please correct me if I am wrong ! I am very new to UNIX scripting. Currently my problem is that I have a code file at the location /home/usr/workarea/GeneratedLogs.log :- Code :- (Feb 7, 571 7:07:29 AM),... (4 Replies)
Discussion started by: acidburn_007
4 Replies

7. Shell Programming and Scripting

Cut and paste data in new file

HI Guys, I have file A: Abc XyZ Abc Xyz Kal Kaloo Abc XyZ Abc Xyz Kalpooo Abc XyZ Abc Xyz Kloo Abc Abc Klooo I want file B Abc XyZ Abc Xyz Kal Kaloo Abc XyZ Abc Xyz Kalpooo Abc XyZ Abc Xyz Kloo File A is now 1 lines Abc Abc Klooo Cut all lines which have xyz... (2 Replies)
Discussion started by: asavaliya
2 Replies

8. Shell Programming and Scripting

Cut, replace and Paste a String from one file to another

I need to cut all the Strings in one file and Paste it in the another file in the Specific line by replacing the specific String. For Example Step 1: From the newfile.txt, i need to copy all the strings newfile.txt How are you, I am fine, How is your work newfle2.txt Hello david,... (2 Replies)
Discussion started by: Padmanabhan
2 Replies

9. Shell Programming and Scripting

Problem in cut or paste

Hello, I have some problem in cut or paste command for my text data. Input1.txt : I use cut command : cut -d ' ' -f1 Input1.txt > result.txt result.txt : Then, I use paste command to merge result.txt. paste -d ' ' result.txt Input1.txt > output.txt output.txt showed : I use cut... (1 Reply)
Discussion started by: awil
1 Replies

10. Shell Programming and Scripting

How to cut a pipe delimited file and paste it with another file to form a comma separated outputfile

Hello ppl I have a requirement to split (cut in unix) a file (A.txt) which is a pipe delimited file into A1.txt and A2.txt Now I have to join (paste in unix) this A2.txt with external file A3.txt to form output file A4.txt which should be CSV (comma separated file) so that third party can... (25 Replies)
Discussion started by: etldev
25 Replies
TRACE-CMD-MEM(1)														  TRACE-CMD-MEM(1)

NAME
trace-cmd-mem - show memory usage of certain kmem events SYNOPSIS
trace-cmd mem [OPTIONS][input-file] DESCRIPTION
The trace-cmd(1) mem requires a trace-cmd record that enabled the following events: kmalloc kmalloc_node kfree kmem_cache_alloc kmem_cache_alloc_node kmem_cache_alloc_free It then reads the amount requested and the ammount freed as well as the functions that called the allocation. It then reports the final amount of bytes requested and allocated, along with the total amount allocated and requested, as well as the max allocation and requested during the run. It reports the amount of wasted bytes (allocated - requested) that was not freed, as well as the max wasted amount during the run. The list is sorted by descending order of wasted bytes after the run. Function Waste Alloc req TotAlloc TotReq MaxAlloc MaxReq MaxWaste -------- ----- ----- --- -------- ------ -------- ------ -------- rb_allocate_cpu_buffer 768 2304 1536 2304 1536 2304 1536 768 alloc_pipe_info 400 1152 752 1152 752 1152 752 400 instance_mkdir 252 544 292 544 292 544 292 252 __d_alloc 215 1086560 1086345 1087208 1086993 1086560 1086345 215 get_empty_filp 72 2304 2232 4864 4712 4864 4712 152 mm_alloc 40 960 920 960 920 960 920 40 prepare_creds 32 192 160 1728 1440 1728 1440 288 tracing_buffers_open 8 32 24 32 24 32 24 8 do_brk 0 0 0 368 368 368 368 0 journal_add_journal_head 0 6048 6048 6048 6048 6048 6048 0 journal_start 0 0 0 1224 1224 48 48 0 __rb_allocate_pages 0 3289856 3289856 3289856 3289856 3289856 3289856 0 anon_vma_alloc 0 0 0 936 936 864 864 0 [...] OPTIONS
-i input-file By default, trace-cmd hist will read the file trace.dat. But the -i option open up the given input-file instead. Note, the input file may also be specified as the last item on the command line. SEE ALSO
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-hist(1), trace-cmd-split(1), trace-cmd-listen(1) AUTHOR
Written by Steven Rostedt, <rostedt@goodmis.org[1]> RESOURCES
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git COPYING
Copyright (C) 2013 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL). NOTES
1. rostedt@goodmis.org mailto:rostedt@goodmis.org 06/11/2014 TRACE-CMD-MEM(1)
All times are GMT -4. The time now is 12:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy