"vi"-ing a constantly updated file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers "vi"-ing a constantly updated file
# 8  
Old 04-27-2007
Is it feasible..?

Hi Percy,
I wonder why the command
Code:
sed '/hashcode/ d' logfile > temp ; mv -f temp logfile

wont be useful..!

Is that because it takes time to perform 'sed' and 'mv' operations. But in this case, you can type a single command and relax Smilie

BTW, if u have perl installed, I can suggest one more command..

Code:
perl -i -ne 's/^.*hashcode.*//; print if/\S/;' logfile

One shortcoming of this command is that it will remove any other blank lines in the file, if present.

Is the command(s) suggested feasible?

Thanks
Srini

Last edited by srinivasan_85; 04-27-2007 at 02:00 AM.. Reason: Adding some more details
# 9  
Old 04-27-2007
Perl is banned around here by the powers that be.

As for the sed command - yes, this would be good, if I fancy messing around with a 2048 char hashcode Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Permission error when "touch"ing file with different user

Hi, There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl : root@digidb2:# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/ root@digidb2:# setfacl -s... (3 Replies)
Discussion started by: anaigini45
3 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Ignore "a line" within /etc/profile only when su'ing

Is there a way to ignore a command within /etc/profile only when su'ing as any particular user. For instance.... As root, if I run "su - oracle -c program" it is running a string in my profile called "echo "^2;$(hostname)-(ABC) @ $(who am i)^G". I don't want the above string to run if I... (9 Replies)
Discussion started by: lwif
9 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question