Sponsored Content
Full Discussion: cut and paste
Top Forums Shell Programming and Scripting cut and paste Post 302359104 by gpaulose on Monday 5th of October 2009 08:22:09 PM
Old 10-05-2009
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:
Code:
83510000000000063800000.1800000.1600000.1600000.2400000.1800000.2000000.21
83510000000000064500000.1100000.2800000.1000000.1200000.1900000.1200000.12
83510000000000064500000.1100000.2800000.1000000.1200000.1900000.1200000.13
83510000000000064900001.7800001.0400001.2300001.2600001.0900001.9000001.48
83510000000000065100000.2500000.1400000.2300000.3300000.2300000.2300000.20

if 835100000000000638 is found, i need to replace it with 835100000000000639 and write to a new file. Also I need the 835100000000000638 to be deleted from my exising file.

I tried
Code:
sed -n "s/835100000000000638/835100000000000639/p oldfile > newfile

this will find and write to new file but wont delete from existing file.

Please help.
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Cut, Copy and Paste with X

One of the things that I have learned to take for granted in the Win32 world is the cut, copy and paste hotkeys of ^X, ^C and ^V. I use these keys all the time under Win32 to copy and paste information from one GUI into another GUI. My question is, does X have a similiar standard? ... (4 Replies)
Discussion started by: auswipe
4 Replies

2. 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

3. Shell Programming and Scripting

Cut Paste and Insert Help

Hello I have a very large file where say each line is made up of 80 characters. I want to cut the characters from 20-30 and 50-60 from each line and then insert a delimiter between them (# or | etc). eg input file 000000000131.12.20990000590425246363375670011200140406... (5 Replies)
Discussion started by: PradeepRed
5 Replies

4. Shell Programming and Scripting

cut and paste using awk

Hi i need a favour i have a file which has some trillions of records. The file is like this 11111000000000192831840914000000000000000000000000000 45789899090000000000000000011111111111111111111111111 I want to cut specific postions in each line like cut1-3 and assisgn it to a variable and... (5 Replies)
Discussion started by: richa2.m
5 Replies

5. UNIX for Dummies Questions & Answers

cut and paste from two tables

Hello, I want to be able to cut and paste columns from two tables in one command. Presently I do the following: cut -f 1,3-6,9 table1.in > table1.out cut -f 7,6,1-3 table2.in > table2.out paste table1.out -d '\t' table2.out > MergedTable.out Is there a better way to do this? ... (1 Reply)
Discussion started by: Gussifinknottle
1 Replies

6. 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

7. UNIX for Dummies Questions & Answers

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 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... (9 Replies)
Discussion started by: swapsb
9 Replies

8. 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

9. Shell Programming and Scripting

Issue with cut and paste

let i have A file and B file A has contains 4 fields as below ---------------- f1 f2 f3 f4 B file consists of 5 fields as below -------------------- f5 f6 f7 f8 f9 need to display as below output: f5 f1 f3 f8 f9 (2 Replies)
Discussion started by: ANSHUMAN1983
2 Replies

10. 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
IDMAP_TDB(8)                                                System Administration tools                                               IDMAP_TDB(8)

NAME
idmap_tdb - Samba's idmap_tdb Backend for Winbind DESCRIPTION
The idmap_tdb plugin is the default backend used by winbindd for storing SID/uid/gid mapping tables. In contrast to read only backends like idmap_rid, it is an allocating backend: This means that it needs to allocate new user and group IDs in order to create new mappings. The allocator can be provided by the idmap_tdb backend itself or by any other allocating backend like idmap_ldap or idmap_tdb2. This is configured with the parameter idmap alloc backend. Note that in order for this (or any other allocating) backend to function at all, the default backend needs to be writeable. The ranges used for uid and gid allocation are the default ranges configured by "idmap uid" and "idmap gid". Furthermore, since there is only one global allocating backend responsible for all domains using writeable idmap backends, any explicitly configured domain with idmap backend tdb should have the same range as the default range, since it needs to use the global uid / gid allocator. See the example below. IDMAP OPTIONS
range = low - high Defines the available matching uid and gid range for which the backend is authoritative. If the parameter is absent, Winbind fails over to use the "idmap uid" and "idmap gid" options from smb.conf. EXAMPLES
This example shows how tdb is used as a the default idmap backend. It configures the idmap range through the global options for all domains encountered. This same range is used for uid/gid allocation. [global] # "idmap backend = tdb" is redundant here since it is the default idmap backend = tdb idmap uid = 1000000-2000000 idmap gid = 1000000-2000000 This (rather theoretical) example shows how tdb can be used as the allocating backend while ldap is the default backend used to store the mappings. It adds an explicit configuration for some domain DOM1, that uses the tdb idmap backend. Note that the same range as the default uid/gid range is used, since the allocator has to serve both the default backend and the explicitly configured domain DOM1. [global] idmap backend = ldap idmap uid = 1000000-2000000 idmap gid = 1000000-2000000 # use a different uid/gid allocator: idmap alloc backend = tdb idmap config DOM1 : backend = tdb idmap config DOM1 : range = 1000000-2000000 AUTHOR
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. Samba 3.5 06/18/2010 IDMAP_TDB(8)
All times are GMT -4. The time now is 04:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy