Sponsored Content
Top Forums Shell Programming and Scripting grep and delete 2nd duplicated of txt... -part2 Post 302103495 by happyv on Friday 19th of January 2007 01:24:23 AM
Old 01-19-2007
Quote:
Originally Posted by kapilraj
count=0
cat {1} | while read line
do
count=`echo "${count} + 1" | bc`
cc=`head -${count} ${1} |grep -c ${line}`
if [ ${cc} -eq 2 ]
then
:
else
echo ${line}
fi
done

Would this work ? I have not tested it but it should work. save it as a file , give it execute permission and then use it as "script filename".

All the best. It's a simple logic but i think that would work for you.

Regds,

Kaps
LOOK WOKING...BUT can I specify any word to delete? such as orange..and it can delete the 2nd duplicated of "orange" only.
 

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

sftp not get txt file 2nd time

I use sftp batch script to copy file from a remote server to local machine. Problem is when I rerun this shell after copying txt file it do not allow me to copy txt file again. My question is , is this confrigration problem of remote server. beace same shell work fie with the other remote... (3 Replies)
Discussion started by: Jamil Qadir
3 Replies

2. Shell Programming and Scripting

sed to read x.txt and grep from y.txt

How would I write a command(s) to read from a file (list) that looks like this: 29847374384 and grep from a second file (list) that looks like this: 29847374384, jkdfkjdf,3833,ddd:confused: (1 Reply)
Discussion started by: smellylizzard
1 Replies

3. Shell Programming and Scripting

delete duplicated characters in each line

I'm a biologist trying to analyse some data and I'll appreciate some help with the following problem. I have a column of characters which I'll like to delete the duplicated characters in each line and report only the unique one.No sorting should be done. E.g. The original data: GTG CTC CTC... (5 Replies)
Discussion started by: ivpz
5 Replies

4. Shell Programming and Scripting

Delete first and second lines from .txt

Hi, I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines. Because I don't know anything about shell script I need your help. Does anyone have a command or a hint, where I can look for? ... (1 Reply)
Discussion started by: mkrol
1 Replies

5. Homework & Coursework Questions

Delete first both lines from .txt

Hi, I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines. Because I don't know anything about shell script I need your help. Does anyone have a command or a hint, where I can look for? ... (1 Reply)
Discussion started by: mkrol
1 Replies

6. UNIX for Dummies Questions & Answers

If then else for decimal numbers part2

Hi, I have a small problem with my script. I have everything in order but it doesnt seem to compare anything less than 1 correctly. If the input is more than 1, then the results is correct. If the input is 0.xxx (anything) it returns erroneous results. Pls help input=0.12 if ; then ... (7 Replies)
Discussion started by: streddy
7 Replies

7. Shell Programming and Scripting

Delete file2.txt from file1.txt using scripting

Hi, I`m a total newbie, well my requirement is that i have 2 files I want to identify which countries i do not currently have in db.. how can i use the grep or another command to find this file .. i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Discussion started by: beanbaby
11 Replies

8. Shell Programming and Scripting

Delete duplicated fields in a line

Hi, I have files with this kind of format (separator is space): A1 B1 C1 D1 E1 F1 D1 C1 G1 H1 A2 B2 C2 D2 E2 F2 D2 C2 G2 H2 A3 B3 C3 D3 E3 F3 G3 D3 C3 H3 A4 B4 C4 D4 E4 F4 G4 D4 C4 H4 I want the output to be: A1 B1 E1 F1 G1 H1 A2 B2 E2 F2 G2 H2 A3 B3 E3 F3 G3 H3 A4 B4 E4 F4 G4... (12 Replies)
Discussion started by: Gr4wk
12 Replies

9. UNIX for Dummies Questions & Answers

Delete files in a txt file

Hi, I have very old files in my server like from 2012 and i want to delete them, Please help. Thanks in advance.. (2 Replies)
Discussion started by: nanz143
2 Replies

10. Shell Programming and Scripting

How to delete 'duplicated' column values and make a delimited file too?

Hi, I have the following output from an Oracle SQL statement and I want to remove duplicated column values. I know it is possible using Oracle analytical/statistical functions but unfortunately I don't know how to use any of those. So now, I've gone to PLAN B using awk/sed maybe or any... (5 Replies)
Discussion started by: newbie_01
5 Replies
CIFSIOSTAT(1)							Linux User's Manual						     CIFSIOSTAT(1)

NAME
cifsiostat - Report CIFS statistics. SYNOPSIS
cifsiostat [ -h ] [ -k | -m ] [ -t ] [ -V ] [ interval [ count ] ] DESCRIPTION
The cifsiostat command displays statistics about read and write operations on CIFS filesystems. The interval parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since system startup (boot). Each subsequent report contains statistics collected during the interval since the previous report. A report con- sists of a CIFS header row followed by a line of statistics for each CIFS filesystem that is mounted. The count parameter can be specified in conjunction with the interval parameter. If the count parameter is specified, the value of count determines the number of reports gener- ated at interval seconds apart. If the interval parameter is specified without the count parameter, the cifsiostat command generates reports continuously. REPORT
The CIFS report provides statistics for each mounted CIFS filesystem. The report shows the following fields: Filesystem: This columns shows the mount point of the CIFS filesystem. rB/s (rkB/s, rMB/s) Indicate the average number of bytes (kilobytes, megabytes) read per second. wB/s (wkB/s, wMB/s) Indicate the average number of bytes (kilobytes, megabytes) written per second. rop/s Indicate the number of 'read' operations that were issued to the filesystem per second. wop/s Indicate the number of 'write' operations that were issued to the filesystem per second. fo/s Indicate the number of open files per second. fc/s Indicate the number of closed files per second. fd/s Indicate the number of deleted files per second. OPTIONS
-h Make the CIFS report easier to read by a human. -k Display statistics in kilobytes per second. -m Display statistics in megabytes per second. -t Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below). -V Print version number then exit. ENVIRONMENT
The cifsiostat command takes into account the following environment variables: S_TIME_FORMAT If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The nfsiostat command will use the ISO 8601 format (YYYY-MM-DD) instead. The timestamp displayed with option -t will also be com- pliant with ISO 8601 format. BUG
/proc filesystem must be mounted for cifsiostat to work. FILE
/proc/fs/cifs/Stats contains CIFS statistics. AUTHORS
Written by Ivana Varekova (varekova <at> redhat.com) Maintained by Sebastien Godard (sysstat <at> orange.fr) SEE ALSO
sar(1), pidstat(1), mpstat(1), vmstat(8), iostat(1), nfsiostat(1) http://pagesperso-orange.fr/sebastien.godard/ Linux JANUARY 2011 CIFSIOSTAT(1)
All times are GMT -4. The time now is 04:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy