![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find and replace command in one line using one command | vasikaran | UNIX for Dummies Questions & Answers | 10 | 08-20-2008 11:40 AM |
| using sed command to replace multiple lines | radha.kalivar | Shell Programming and Scripting | 1 | 07-10-2007 11:36 AM |
| vi command - replace | tictactoe | UNIX for Dummies Questions & Answers | 1 | 09-16-2006 10:33 PM |
| Command to replace character | HLee1981 | UNIX for Dummies Questions & Answers | 5 | 10-17-2005 02:27 AM |
| replace text in a file from the command line... | dudboy | UNIX for Dummies Questions & Answers | 1 | 09-04-2001 03:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How I can replace this command --need help
Hi,
can I delate first line in a file without opening a file. Normal unix "sed -i '1d' $path/cash.log" command is working fine, but my windows application not supporting latest version of sed, I also tried to download latest version of sed.exe but failed to find one. I am in a process of implement a buffer mechanism using following script #!/bin/sh path=C:/APPS/Tivoli/bin/w32-ix86/TME/TEC/scripts set -x exec 2> $path/SMS_LOG1.log Cash_count=`more $path/cash.log |wc -l` while [ "$Cash_count" != "0" ] do sms=`head -1 $path/cash.log` echo "#MSG#$sms" >>$path/output sleep 5 sed -i '1d' $path/cash.log Cash_count=`more $path/cash.log |wc -l` #echo "Cash_count: $Cash_count" done < $path/cash.log Please help me on this. Thanks in advance Regards Sudhish |
|
||||
|
but I what to delete the first line
Hi,
awk ' NR > 1 { print > "newfile.back" }' currentfile It is working fine, but I what to delete the first line since it is loop command I cant replace the file. Thanks in advance Regards Sudhish |
|
||||
|
Code:
It is working fine, but I what to delete the first line since it is loop command I cant replace the file. Thanks in advance If you had to process within a loop, this might help, awk command; ( you have the new file ) mv new_file old_file Last edited by matrixmadhan; 06-21-2007 at 10:14 AM.. Reason: typo |
|
||||
|
Deletion of first line is the problem
Hi,
Let me explain my requirement 1. $path/cash.log is a cash file, I can’t rename it because it content is loaded by another script 2. This script will send SMS until cash.log file become empty also it will continue check for the messages, start sending sms as soon as the message comes 3. Script can only take first line of the cash.log file and send SMS 4. Then I have to delete the first line, other wise script will always send same message only Deletion of first line is the problem Thanks in advance Sudhish |
|
||||
|
Deletion of first line is the problem
Hi,
Let me explain my requirement 1. $path/cash.log is a cash file, I can’t rename it because it content is loaded by another script 2. This script will send SMS until cash.log file become empty also it will continue check for the messages, start sending sms as soon as the message comes 3. Script can only take first line of the cash.log file and send SMS 4. Then I have to delete the first line, other wise script will always send same message only Deletion of first line is the problem Thanks in advance Sudhish |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|