Skip to main content

All Questions

Tagged with
2 votes
4 answers
292 views

Show changes between consecutive lines of a file

Is there an easy way to see how lines are changing in a file? For example, assume I have this "my.log" file: cpu1 cpu2 cpu3 cpu4 5 3 3 6 5 3 3 6 5 0 3 6 ...
bobuhito's user avatar
  • 123
0 votes
3 answers
61 views

Changing content format [duplicate]

I have a text file which has 1000 rows/entries. These 1000 entries correspond to the column names for my dataframe. These are the new features that need to be added to the dataframe for model ...
user2359877's user avatar
0 votes
3 answers
2k views

Find a value in a specific position when the only information you have is the position

I have a csv file approximately 16,000 rows long, with two fields. The first field contains a list of numeric values, and the second field contains a list of first and names delimited by semi-colons ...
nattac's user avatar
  • 3
2 votes
1 answer
87 views

any way to make this command chain shorter or better

I am using this command chain to filter out bot/crawler traffic and ban the ip addresses. Is there any way i can make this command chain more efficient? sudo awk -F' - |\\"' '{print $1, $7}' access....
Dan's user avatar
  • 193
1 vote
1 answer
152 views

How to parse strings from a file in multiple other files?

I am trying to grep a list of strings listed in 7253.txt which looks like this: rs11078372 rs1124961 rs11651880 rs11659047 rs1736209 using: grep -o -f 7253.txt *.logistic > result.txt from ...
Ana's user avatar
  • 35
1 vote
1 answer
41 views

Element comparison between subsequent lines, assigning a value for each null output

I have an output which looks like this: ASCII file I want to pick up the last element from the rows that contain the string "Fe\s2b". But the thing is each occurrence of "H\s\s1\s\s\s\s\s\s4861.33A" ...
stp30's user avatar
  • 111
0 votes
2 answers
5k views

Find specific folder path in s3 bucket

I'm searching a folder in s3 bucket using this command aws s3 ls s3://bucketname/dir1/dir2/dir3 --recursive | grep -i 'dir3' It's getting results like dir1/dir2/dir3/1/aaa.txt dir1/dir2/dir3/1/bbb....
Jaimin Gosai's user avatar
-1 votes
3 answers
380 views

How to use grep and/or awk to select multiple pathnames in file and remove those files?

I have some output that is formatted like so: foo: /some/long/path_with_underscores-and-hyphens/andnumbers1.ext exists in filesystem foo: /another/one.ext exists in filesystem bar: /another/path/and/...
Elfen Dew's user avatar
0 votes
1 answer
214 views

Bash User Input Search For Who is On Server If Statement Error Too Many Arguments

I am working on an assignment that requires me to accept user input to search for current users on the server and if the user input is online, I need to output the users name. If the user is not ...
codenewbie503's user avatar
0 votes
3 answers
921 views

How to match a pattern in lines before another pattern match

This question is similar to How to show lines after each grep match until other specific match? I want to match a particular pattern in lines before another pattern match. Here I want to get the ...
hardik p's user avatar
  • 103
9 votes
2 answers
8k views

Testing regex from stdin using grep|sed|awk

Sometimes, I want to test is my regex correct. How can I do reverse regex match from stdin? F.e. I can match a string with provided regex, like: grep "\(foo\)-bar" foo bar foo-bar foo-bar #Match ...
fugitive's user avatar
  • 1,573
1 vote
1 answer
913 views

extract lines from large tab delimited file using a list

I have a large tab file with 15 columns (FILE1) and a list (FILE2) of names which should appear in the table. The problem is the name may appear in columns 4 to 10 in FILE1 and it may not be a case ...
AudileF's user avatar
  • 185
0 votes
1 answer
97 views

how grep text upto next space?

7/04/27 10:50:17 INFO Master: Driver submitted org.apache.spark.deploy.worker.DriverWrapper 17/04/27 10:50:17 INFO Master: Launching driver driver-20170427105017-0000 on worker worker-20170427103840-...
xyz_scala's user avatar
  • 131
1 vote
3 answers
947 views

How do I make a substitution to `$0` but save the old value?

I'm trying to rename all files that start with an "m" to be the same name except with the first character (or "m" in this case) stripped away. My strategy is to: List all the files, with ls Filter ...
mbigras's user avatar
  • 3,170
2 votes
4 answers
335 views

Grep with range and pass three filters

I have a file sample.txt ------------- ord:chandru SAM XY DUPL KEY:ZZ ------------- ord:RAM SAM XY DUPL KEY:UU ------------- ord:chandru SAM XY DUPL ...
chandu's user avatar
  • 191

15 30 50 per page