Sponsored Content
Top Forums Shell Programming and Scripting copy and paste a specific line Post 302170097 by tiger99 on Sunday 24th of February 2008 10:37:57 AM
Old 02-24-2008
Hi All
I have spent almost a week trying to resolve my cut issue.

I have two files:
new:
79 /vobs/aw/database/proc/awAcctMgmt/awGetOptionCallActionByLevel.proc@@/main/solmar08/1

80 /vobs/aw/database/proc/awAcctMgmt/awGetOptionOrderActionByLevel.proc@@/main/solmar08/1

proc.txt
/vobs/aw/database/proc/awAcctMgmt/awGetOptionCallActionByLevel.proc@@/main/solmar08/1


I try to remove lines in (new) based on (proc.txt)

The following code works on cygwin but it doesn't work on SunOS 5.8

Code:
#!/bin/bash



DRAFT="./new"

REMOVE="./proc.txt"

TMP="/tmp/proc.tmp"



cat $REMOVE | while read line; do

    awk -v rem="${line}" '{if ($2 != rem) {print $0} else {print ""}}' ${DRAFT} > ${TMP}

    mv ${TMP} ${DRAFT}

done

I get the following error message
awk: syntax error near line 1
awk: bailing out near line 1

I also try sed instead of awk

Code:
sed '/'"${line}"'/d' ${DRAFT}

I get the following error message
First RE may not be null


I am really stucked. Smilie
Could someone please give me some assistant...
 

9 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. UNIX for Dummies Questions & Answers

cut, copy + paste

Hi all! How do I cut, copy and paste under unix??? (2 Replies)
Discussion started by: aitor314
2 Replies

3. Shell Programming and Scripting

How to copy and paste line in shell script

Hi I want to grep for a line and copy and paste that line. for Example ---- file abc.txt ---- host=atlx1 sid=atld1 mail=abc@abc.com host=atlx2 sid=atld2 mail=xyz@abc.com host=atlx3 sid=atld3 mail=def@abc.com host=atlx4 sid=atld4 mail=mno@abc.com --- end of file abc.txt ---- Now I... (16 Replies)
Discussion started by: upsrk
16 Replies

4. UNIX for Dummies Questions & Answers

vi copy/paste problem

I'm having a problem copy/pasting from a txt file in windows to vi. What happens is I copy a chunk of text, go to the putty terminal, go into insert mode, and right click, and it will stop pasting at a random point and freeze up. Nothing I do gets out of it. This only happens on my account... (1 Reply)
Discussion started by: solidarity
1 Replies

5. UNIX for Dummies Questions & Answers

vim copy line and paste at the beginning, middle, and end of another line

How would you do vim copy line and paste at the beginning, middle, and end of another line. I know yy copies the whole line and p pastes the whole line, but on its own separate line. Sometimes I would like to copy a line to the beginning, middle, or end of another line. I would think this would be... (3 Replies)
Discussion started by: cokedude
3 Replies

6. Shell Programming and Scripting

Copy some line and paste it after some line in same file

Hi, I want to know how I can copy line 6th to 10th and paste it after 17th line in same file. Thanks, Biplab (19 Replies)
Discussion started by: Biplab
19 Replies

7. Shell Programming and Scripting

Copy n paste n times

I have one mainframe copy book where I want to copy n times depend on occurs which mention below. Example: Below highlighted row mention “occurs 2 times” so I need to copy 2 times till next label 10. C14992 10 FILLER PIC X(2835). 01 ... (7 Replies)
Discussion started by: srivalli
7 Replies

8. UNIX for Dummies Questions & Answers

Copy/paste in vi editor

Hello guys, I am trying to copy a line in vi editor and paste it with below commands but paste command is not working and instead of paste action prints the p character!! I should also mention that the server is Solaris... 1) crontab -e 2) j to move down 3) yy to copy the line 4) o to... (4 Replies)
Discussion started by: Newman
4 Replies

9. Shell Programming and Scripting

Grep string in a file and paste next line in a specific way

Hello, I know there are many questions and replies regarding grep command. What I would like to do is a bit different. File A: hello world welcome to my page this is my test site how are you I am fine, thank you where have you been I was in hospital really hope you are fine now Thanks,... (10 Replies)
Discussion started by: baris35
10 Replies
Tcl_CreateCloseHandler(3tcl)				      Tcl Library Procedures				      Tcl_CreateCloseHandler(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler - arrange for callbacks when channels are closed SYNOPSIS
#include <tcl.h> void Tcl_CreateCloseHandler(channel, proc, clientData) void Tcl_DeleteCloseHandler(channel, proc, clientData) ARGUMENTS
Tcl_Channel channel (in) The channel for which to create or delete a close callback. Tcl_CloseProc *proc (in) The procedure to call as the callback. ClientData clientData (in) Arbitrary one-word value to pass to proc. _________________________________________________________________ DESCRIPTION
Tcl_CreateCloseHandler arranges for proc to be called when channel is closed with Tcl_Close or Tcl_UnregisterChannel, or using the Tcl close command. Proc should match the following prototype: typedef void Tcl_CloseProc( ClientData clientData); The clientData is the same as the value provided in the call to Tcl_CreateCloseHandler. Tcl_DeleteCloseHandler removes a close callback for channel. The proc and clientData identify which close callback to remove; Tcl_Delete- CloseHandler does nothing if its proc and clientData arguments do not match the proc and clientData for a close handler for channel. SEE ALSO
close(3tcl), Tcl_Close(3tcl), Tcl_UnregisterChannel(3tcl) KEYWORDS
callback, channel closing Tcl 7.5 Tcl_CreateCloseHandler(3tcl)
All times are GMT -4. The time now is 09:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy