Tagged Questions
1
vote
1answer
95 views
reading from a file and changing its pattern into an array?
I have a CSV file containging entries like this :
ipaddress,VLAN,VLANid
10.192.168.1,vlan-xyz,3
10.192.168.1,vlan-abc,8
10.192.168.1,vlan-mnp,11
10.192.163.24,vlan-llz,3
10.192.163.24,vlan-bbz,5
...
1
vote
4answers
67 views
How to find what device a file is on (and use that in a script)?
I want to find out what device my file is on so that I can use it in a script. I can get this far:
$ df .
Filesystem 512-blocks Used Available Capacity Mounted on
/dev/disk0s2 498438976 ...
3
votes
5answers
159 views
Print non-existent files from a pipe input
I have a directory of lots of .PDF and .JPG files.
There should be a .JPG file for each .PDF with the same name.
I'm trying to use a command to find .PDF files that doesn't have a .JPG file.
My ...
1
vote
5answers
208 views
Replacing lines in files with file contents
I have several files which contain some PHP includes and I want to substitute them with the file contents. The file looks like
foo
<?php
include("file1.php");
?>
bar
baz
<?php
...
8
votes
3answers
2k views
Delete the first n bytes of files
I've got an extreme problem, and all of the solutions I can imagine are complicated. According to my UNIX/Linux experience there must be an easy way.
I want to delete the first 31 bytes of each file ...
2
votes
3answers
633 views
Delete files if contents do not match pattern
There are hundreds of .html files in a directory. I need to delete files that don't contain word bluecar in their contents.
I thought sed with rm would do that, but I don't know how to combine them.
8
votes
6answers
220 views
Grab certain contents of a file
So I know tools exist for this problem because I've heard about them, but I don't know what they are.
I want to do something like filter out all data but the usernames in /etc/passwd.
For example, I ...