Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Delete multiple lines between blank lines containing two patterns Post 303018935 by vgersh99 on Tuesday 19th of June 2018 11:14:35 AM
Old 06-19-2018
Do you want to delete duplicate "records"?
If so:
Code:
awk '!a[$0]++' RS= myFile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete blank lines or lines with spaces only

hi there i'm trying to delete blank lines and or lines with spaces only from a series of files in an directory. to do so, i'm using this: for files in `ls /users/myname/pesop* 2>/dev/null` do grep -v ^$ $files > newfile mv newfile $files done now, this works great for blank lines but... (3 Replies)
Discussion started by: vascobrito
3 Replies

2. Shell Programming and Scripting

regex to delete multiple blank lines in a file?

can't figure out a way to delete multiple empty lines but keep single empty lines in a file, file is like this #cat file 1 2 3 4 5 6 - What I want is 1 2 (6 Replies)
Discussion started by: fedora
6 Replies

3. UNIX for Dummies Questions & Answers

delete blank lines from a file

can anyone show me how to delete blank lines from a file. thanks in advance (2 Replies)
Discussion started by: sachin.gangadha
2 Replies

4. UNIX for Dummies Questions & Answers

delete traling blank lines only

Hi, I have blank line in the file, I just want to remove trailing blank lines. There are some blank lines between the lines, i don't want remove those. Just want to delete blank lines at the end. I used this command sed '/^$/d' infile > outfile, but it is not removing anything. I think... (1 Reply)
Discussion started by: visu
1 Replies

5. Shell Programming and Scripting

Why cant i delete blank lines?

I have a sed pipeline: myVar=$(cat $FILE | sed -n '/regex/,/regex/{/regex/d;p}' | sed -n '/regex/!p' | sed -e s/*:// | sed /regex/,+8d \ ) sed '/^$/d' sed '/./!d' And i've tried to add that in a different order rather then just on the end..Why isnt it deleting all the blank... (2 Replies)
Discussion started by: omgsomuchppl
2 Replies

6. Shell Programming and Scripting

delete lines between patterns

Hi, I've searched in this forum all day long but was not able to find enough codes to help me do a task. The only code that I can come up with is this: sed '/ /,/ /{//p;d;}' inputfile > outputfile I would like to sed/awk/grep a file for two patterns and then delete the lines between... (4 Replies)
Discussion started by: shamushamu
4 Replies

7. Shell Programming and Scripting

Delete blank lines, if blank lines are more than one using shell

Hi, Consider a file named "testfile" The contents of file are as below first line added for test second line added for test third line added for test fourth line added for test fifth line added for test (5 Replies)
Discussion started by: anil8103
5 Replies

8. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

9. Shell Programming and Scripting

Delete blank lines in a file

Hi All, I have a file and I need to delete the lines that are blank and is starting with some characters below. Something like below: Regular Ascii File: Line1: AGODA1 BUSAN||SK Lord Beach 4/6/2012 4/7/2012 68060 Line2: AGODA2 BUSAN||SK Beach Hotel 4/6/2012 4/7/2012 610200 Line3: ... (4 Replies)
Discussion started by: rkumar28
4 Replies

10. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

Hi Gurus, Somebody can say me how to delete blank spaces and blank lines in a file unix, please. Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies
GETFILEINFO(1)						    BSD General Commands Manual 					    GETFILEINFO(1)

NAME
/usr/bin/GetFileInfo -- get attributes of files and directories SYNOPSIS
/usr/bin/GetFileInfo [-P -a[<attribute-letter>] | -c | -d | -m | -t] file ... DESCRIPTION
/usr/bin/GetFileInfo is a tool to get the file attributes. With no flags, GetFileInfo retrieves all information about the file. If exactly one option is provided, GetFileInfo retrieves and displays just that information; supplying more than one is an error. Flags: -P Acts on a symlink file instead of the file the symlink resolves to. -a[<attribute-letter>] Gets a file's attribute bits where <attribute-letter> is one of the following: a Alias file b Has bundle c Custom icon (allowed on folders) d Located on the desktop (allowed on folders) e Extension is hidden (allowed on folders) i Inited - Finder is aware of this file and has given it a location in a window. (allowed on folders) l Locked m Shared (can run multiple times) n File has no INIT resource s System file (name locked) t "Stationery Pad" file v Invisible (allowed on folders) z Busy (allowed on folders) The value of a single attribute is printed as 0 for off or false, 1 for on or true. If no attribute letter is specified, the value of all attributes is returned, with lowercase letters representing off or false, and uppercase representing on or true. -t Gets the file type, a string of exactly four characters. If the type is not set, these will display as an empty pair of quo- tation marks. Directories do not have types, so the type will be skipped if all information is being displayed; specifying -t for a directory is an error. -c Gets the file's creator, a string of four characters enclosed in quotation marks. If the creator is not set, these will dis- play as an empty pair of quotation marks. Directories do not have creators, so the creator will be skipped if all information is being displayed; specifying -c for a directory is an error. -d Gets the creation date, a string of the form "mm/dd/yyyy hh:mm:ss" in 24-hour clock format. -m Gets the modification date, a string of the form "mm/dd/yyyy hh:mm:ss" in 24-hour clock format. RETURN VALUES
0 success 1 syntax error 2 any other error SEE ALSO
SetFile(1) EXAMPLES
The following command line gets and prints the creator for the "Late Breaking News" file: /Developer/Tools/GetFileInfo -c "Late Breaking News" This command line prints the modification date of "myFile": /Developer/Tools/GetFileInfo -m myFile Mac OS X September 27, 2005 Mac OS X
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy