02-27-2008
removing particular lines ending with a .cnt extension in a text file
I have a text file with rows of information (it is basically a ls command information(o/p from ls command))
I need to remove the lines ending with a .cnt extension and keep the lines ending with .zip extension, how to accomplish this.
I also only need the date,size and name of the file from every row, i want to get rid of the permissions column at the first how do i accomplish this. any help is appreciated.
my file is a.txt its contents are
-rwx---rwx may 10 2007 236748629 d_lst_tst.cnt
-rwxrwxrwx may 12 2007 376864923 d_lst_tet.zip
-rwx-wx-wx may 12 2007 480527935 d_ink_let.cnt
----rwxrwx may 12 2007 367859629 f_ink_let.zip
I want to remove the first and third line from my text file and also want to remove the "rwx" part from the second and fourth lines how to do this.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file.
I've been... (4 Replies)
Discussion started by: WABonnett
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I'm trying to remove multiple lines of text based off a series of different words and output it to a new file
The document contains a ton of data but i want to delete any line that has the following
mx1.rr.biz.com or ns2.ri.biz.com
i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
Discussion started by: spartan22
3 Replies
3. Shell Programming and Scripting
HI
I'm looking to delete lines ending with .tk from below data file
---------
abc.tk
mgm.tk
dtk
mgmstk
------
I have written below code
----
sed '/.tk *$/d' dat_file.txt > temp.txt
----
But its deleting all the lines ending with tk. I need to delete only the lines ending .tk
my... (5 Replies)
Discussion started by: shekhar_v4
5 Replies
4. UNIX for Dummies Questions & Answers
Hello
i have the files in this format
pdb1i0t.ent
pdb1lv7.ent
pdb1pp6.ent
pdb1tj2.ent
pdb1xg2.ent
pdb2b4b.ent
pdb2ewe.ent
Now i have to remove the prefix pdb from all the files and also i need to change the extension of .ent to .txt
The new file should look like this
... (3 Replies)
Discussion started by: empyrean
3 Replies
5. Shell Programming and Scripting
hi
I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example
Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies
6. UNIX for Dummies Questions & Answers
How do you remove trailing empty lines at the end of a text file? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies
7. Shell Programming and Scripting
How do I remove line that do not contain text, but that do contain tabs?
I have tried the command
cat file | awk NF
but that doesn't work when the lines contain tabs (and spaces).
I have also tried:
cat file | sed '/^$/d' (9 Replies)
Discussion started by: locoroco
9 Replies
8. Shell Programming and Scripting
Hi, I have multiple large files which consist of the below format:
I am trying to write an awk or sed script to remove all occurrences of the 00 record except the first and remove all of the 80 records except the last one.
Any help would be greatly appreciated. (10 Replies)
Discussion started by: nwalsh88
10 Replies
9. Shell Programming and Scripting
Hello.
I'm writing a script where every file you create will generate a md5sum and store it into a text file.
Say I create 2 files, it'll look like this in the text file:
d41d8cd98f00b204e9800998ecf8427e /helloworld/saystheman
d41d8cd98f00b204e9800998ecf8427e /helloworld/test
I... (3 Replies)
Discussion started by: batarangs_
3 Replies
10. UNIX for Dummies Questions & Answers
Hi Everybody! First post! Totally noobie.
I'm using the terminal to read a poorly formatted book.
The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this.
I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies
LEARN ABOUT REDHAT
getfacl
GETFACL(1) Access Control Lists GETFACL(1)
NAME
getfacl - get file access control lists
SYNOPSIS
getfacl [-dRLPvh] file ...
getfacl [-dRLPvh] -
DESCRIPTION
For each file, getfacl displays the file name, owner, the group, and the Access Control List (ACL). If a directory has a default ACL, get-
facl also displays the default ACL. Non-directories cannot have default ACLs.
If getfacl is used on a file system that does not support ACLs, getfacl displays the access permissions defined by the traditional file
mode permission bits.
The output format of getfacl is as follows:
1: # file: somedir/
2: # owner: lisa
3: # group: staff
4: user::rwx
5: user:joe:rwx #effective:r-x
6: group::rwx #effective:r-x
7: group:cool:r-x
8: mask:r-x
9: other:r-x
10: default:user::rwx
11: default:user:joe:rwx #effective:r-x
12: default:group::r-x
13: default:mask:r-x
14: default:other:---
Lines 4, 6 and 9 correspond to the user, group and other fields of the file mode permission bits. These three are called the base ACL
entries. Lines 5 and 7 are named user and named group entries. Line 8 is the effective rights mask. This entry limits the effective rights
granted to all groups and to named users. (The file owner and others permissions are not affected by the effective rights mask; all other
entries are.) Lines 10--14 display the default ACL associated with this directory. Directories may have a default ACL. Regular files never
have a default ACL.
The default behavior for getfacl is to display both the ACL and the default ACL, and to include an effective rights comment for lines where
the rights of the entry differ from the effective rights.
If output is to a terminal, the effective rights comment is aligned to column 40. Otherwise, a single tab character separates the ACL entry
and the effective rights comment.
The ACL listings of multiple files are separated by blank lines. The output of getfacl can also be used as input to setfacl.
PERMISSIONS
Process with search access to a file (i.e., processes with read access to the containing directory of a file) are also granted read access
to the file's ACLs. This is analogous to the permissions required for accessing the file mode.
OPTIONS
--access
Display the file access control list.
-d, --default
Display the default access control list.
--omit-header
Do not display the comment header (the first three lines of each file's output).
--all-effective
Print all effective rights comments, even if identical to the rights defined by the ACL entry.
--no-effective
Do not print effective rights comments.
--skip-base
Skip files that only have the base ACL entries (owner, group, others).
-R, --recursive
List the ACLs of all files and directories recursively.
-L, --logical
Logical walk, follow symbolic links. The default behavior is to follow symbolic link arguments, and to skip symbolic links encountered
in subdirectories.
-P, --physical
Physical walk, skip all symbolic links. This also skips symbolic link arguments.
--tabular
Use an alternative tabular output format. The ACL and the default ACL are displayed side by side. Permissions that are ineffective due
to the ACL mask entry are displayed capitalized. The entry tag names for the ACL_USER_OBJ and ACL_GROUP_OBJ entries are also displayed
in capital letters, which helps in spotting those entries.
--absolute-names
Do not strip leading slash characters (`/'). The default behavior is to strip leading slash characters.
--version
Print the version of getfacl and exit.
--help
Print help explaining the command line options.
-- End of command line options. All remaining parameters are interpreted as file names, even if they start with a dash character.
- If the file name parameter is a single dash character, getfacl reads a list of files from standard input.
CONFORMANCE TO POSIX 1003.1e DRAFT STANDARD 17
If the environment variable POSIXLY_CORRECT is defined, the default behavior of getfacl changes in the following ways: Unless otherwise
specified, only the ACL is printed. The default ACL is only printed if the -d option is given. If no command line parameter is given, get-
facl behaves as if it was invoked as ``getfacl -''.
AUTHOR
Andreas Gruenbacher, <a.gruenbacher@computer.org>.
Please send your bug reports and comments to the above address.
SEE ALSO
setfacl(1), acl(5)
May 2000 ACL File Utilities GETFACL(1)