Sponsored Content
Top Forums Shell Programming and Scripting Bash repeating lines for some files but not all Post 303010903 by Don Cragun on Tuesday 9th of January 2018 06:34:31 PM
Old 01-09-2018
  1. The output you have shown us might have come from the code you have shown us as an output based on input files you have not shown us or it might be totally unrelated to the code you have shown us. And, we have no way to determine whether it is a product of this code or not.
  2. You definitely have not shown us the output produced by the echo statements in the code you have shown us.
  3. We have no idea what your input files look like.
  4. We have no idea what the names of the input files you are processing look like.
  5. We have no idea what operating system you're using.
  6. We don't know what output you're hoping to get.
Under these conditions, how do you expect us to help you?
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Omit repeating lines

Can someone help me with the following 2 objectives? 1) The following command is just an example. It gets a list of all print jobs. From there I am trying to extract the printer name. It works with the following command: lpstat -W "completed" -o | awk -F- '{ print $1}' Problem is, I want... (6 Replies)
Discussion started by: TheCrunge
6 Replies

2. Shell Programming and Scripting

merge 2 files (without repeating any lines)

I need to add the content of file1 to file2 - all lines but not those existing in file2 already, so the "cat file1 >> file2" doesn't work. For example, file1: 100 xxxxxx str1 102 xxxxxx str2 File2: 50 xxxxxxx xxx 30 xxxxxxxxxxx 102 xxxxxx str2 xxxx ...... the result: 50 xxxxxxx... (9 Replies)
Discussion started by: bluemoon1
9 Replies

3. Shell Programming and Scripting

Merging non-repeating columns of lines

Hello, I have file to work with. It has 5 columns. The first three, altogether, constitutes the position. The 4th column contains some values for downstream analysis and the fifth column contains some values that I want to add to 4th column (only if they happen to be in the same position). My... (5 Replies)
Discussion started by: menenuh
5 Replies

4. Shell Programming and Scripting

Bash script find longest line/lines in several files

Hello everyone... I need to find out, how to find longest line or possibly lines in several files which are arguments for script. The thing is, that I tried some possibilities before, but nothing worked correctly. Example when i use: awk ' { if ( length > L ) { L=length ;s=$0 } }END{ print... (23 Replies)
Discussion started by: 1tempus1
23 Replies

5. UNIX for Dummies Questions & Answers

Remove groups of repeating lines

I know uniq exists, but am not sure how to remove repeating lines when they are groups of two different lines repeating themselves, without using sort. I need them to be sorted in the original order, just to remove repeats. cd /media/AUDIO/WAVE/9780743518673/mp3 ~/Desktop/mp3-to-m4b... (1 Reply)
Discussion started by: glev2005
1 Replies

6. Shell Programming and Scripting

Removing repeating lines from a data frame (AWK)

Hey Guys! I have written a code which combines lots of files into one big file(.csv). However, each of the original files had headers on the first line, and now that I've combined the files the headers are interspersed throughout the new combined data frame. For example, throughout the data... (21 Replies)
Discussion started by: gd9629
21 Replies

7. Shell Programming and Scripting

Printing the lines which are repeating in a files

Hi, I need to find the lines which are repeating in a file cat file1 abcdef 23-1 abcdef 24-1 bcdeff 25-0 ttdcfg 26-0 ttdcfg 20-0 bcdef1 25-0 bcdef2 25-0 bcdef3 25-0 bcdef4 25-0 bcdef4 00-0any help is greatly appreciated. Thanks in advance. In need to find which one are... (3 Replies)
Discussion started by: jpkumar10
3 Replies

8. Shell Programming and Scripting

Compare last 90 logs and print repeating lines with >20

*log files are in date order sample logs... ciscoresets_20120314 ciscoresets_20120313 ciscoresets_20120312 ciscoresets_20120311 ciscoresets_20120310 cat ciscoresets_20120314 SYDGRE04,10,9 SYDGRE04,10,10 SYDGRE04,10,11 SYDGRE04,10,12 SYDGRE04,10,13 SYDGRE04,10,14 SYDGRE04,10,15... (2 Replies)
Discussion started by: slashbash
2 Replies

9. Shell Programming and Scripting

Deleting Repeating lines from a txt file via script

Hi, I'm having trouble in achieving the following scenario. There is a txt file with thousands of lines and few lines are repeated, which needs to be removed using a script. File.txt 20140522121432,0,12,ram Loc=India From=ram@xxx.com, To=ravi@yyy.com,, 1 2 3 4 . . 30... (18 Replies)
Discussion started by: Gautham
18 Replies

10. Shell Programming and Scripting

Bash: copying lines with specific character to files with same name as copied line.

I am trying to make my script as simple as a possible but, I am not sure if the way I am approaching is necessarily the most efficient or effective it can be. What I am mainly trying to fix is a for loop to remove a string from the specified files and within this loop I am trying to copy the lines... (2 Replies)
Discussion started by: Allie_gastrator
2 Replies
LIST-DESKTOP-PROFILES(1)				      General Commands Manual					  LIST-DESKTOP-PROFILES(1)

NAME
list-desktop-profiles - list known profiles that meet given criteria SYNOPSIS
list-desktop-profiles [OPTION] DESCRIPTION
As the number of .listing files holding metadata grows, trying to find out which profiles are present/meet certain criteria becomes increasingly unpleasant. This script remedies that allowing you to just list your criteria, and outputting all profiles meeting those cri- teria. By default it will just output the lines from the .listing files for each (matching) profile, but you can specifying a formatstring to fancy up the output. OPTIONS
-n <regexp>, --name <regexp> Limit shown profiles to those for which the name (1st) field of the profile description needs matches the given regular expression. -k <regexp>, --kind <regexp> Limit shown profiles to those for which the kind (2nd) field of the profile description needs matches the given regular expression. -l <regexp>, --location <regexp> Limit shown profiles to those for which the location (3th) field of the profile description needs matches the given regular expres- sion. -p <comparison>, --precedence <comparison> Limit shown profiles to those for which the precedence (4th) field of the profile description succeeds the given comparison. In the comparison you can Use 'gt' for 'greater then', 'lt' for 'less then', 'ge' for 'greater then or equal to', 'le' for 'less then or equal to', 'eq' for 'equal to', and 'ne' for 'not equal to'. (NOTE: empty precedence-field, is lowest possible precedence) -r <regexp>, --requirement <regexp> Limit shown profiles to those for which the requirements (5th) field of the profile description needs matches the given regular expression. -c <regexp>, --comment <regexp>, --description <regexp> Limit shown profiles to those for which the comment (6th) field of the profile description needs matches the given regular expres- sion. -u <username>, --user <username> Limit shown profiles to those for which the given user meets the requirements. (NOTE: doesn't always give correct results! Results might be wrong when using shell command requirements that depend on the users environment. Or when 'group $USER' gives a different result as 'group' executed as $USER, which can happen when adding groups through pam_group). -d <dir>, --directory <dir> Also use .listing files found in the given directory. This option can be used multiple times to add more then 1 additional directory -e <formatstring>, --entry-format <formatstring> Show profile information according to the specified format spring (instead of just echoing the profile-line). The format string may use the following variables: NAME, LOCATION, PRECEDENCE, REQUIREMENTS, KIND, DESCRIPTION, FILE; the first 6 of these refer to the corresponding field, the last refers to the .listing file the profile is in. (e.g. '$FILE_$NAME - $DESCRIPTION'). Any characters that are interpreted specially by the shell should be escaped. -s <fieldname>|<fieldnumber>, --sort-key <fieldname>|fieldnumber Sort output on the requested field (fieldname is one of name, kind, location, precedence, requirements, or description; fieldnumbers run from 1-6). EXAMPLES
list-desktop-profiles -k KDE -s precedence -u user1 List all kde-profiles that will be activated for user1 in order of precedence. list-desktop-profiles -k 'KDE|GCONF' List all kde and gnome profiles. list-desktop-profiles -p 'gt 50' List all profiles with a precedence value greater then 50. ENVIRONMENT
NAME_FILTER, LOCATION_FILTER, PRECEDENCE_FILTER, REQUIREMENT_FILTER, KIND_FILTER, DESCRIPTION_FILTER Can be used to specify the default regular expressions and comparisons. Default to empty. OUR_USER Set the user for which the requirements need to be met. Defaults to unset. EXTRA_LISTINGS Can be used to specify a (space separated) list of extra .listing files to include. Defaults to empty FORMAT Can be used to specify the default format string. By default it will output the profile-line from the .listing file. SORT_KEY Can be used to specify the default sort-key (= field number). Defaults to 1 FILES
/etc/desktop-profiles/*.listing - Files containing the metadata about installed profiles /etc/default/desktop-profiles - File containing default settings for this script (by way of the environment variables above) BUGS
The '-u <username>' is not guaranteed to work correctly for shell command requirements. Particulary this will give incorrect results if the shell command depends on some state of the user environment. AUTHOR
This manual page was written by Bart Cornelis <cobaco@skolelinux.no>. SEE ALSO
desktop-profiles(7), update-profile-cache(1), profiles-manager(1) desktop-profiles November 11, 2004 LIST-DESKTOP-PROFILES(1)
All times are GMT -4. The time now is 09:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy