Questions tagged [line]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
13
votes
2answers
2k views

How to make a continuous vertical line in vim?

I want to make a table in vim. Making a horizontal line is easy ______________________________ For the vertical I use this yes "|" | head -10 But the result is bad | | | | | | | | | I want ...
11
votes
7answers
2k views

How to remove empty lines from begin and end of file?

I would like to remove empty lines from begin and the end of file, but not remove empty lines between lines. I think sed or awk would be the solution. Source: 1: 2: 3:line1 4: 5:line2 6: 7: 8: ...
6
votes
2answers
32k views

check command line arguments

I would like to check if the first command line argument ($1) has an minimum amount of 10 characters and if it is empty. The script is called as: ./myscript.sh 2018-08-14 I tried this but it doesn'...
4
votes
2answers
349 views

Is there a way to count the number of lines of text in a file including non-delimited ones?

The POSIX wc command counts how many POSIX lines in a file. The POSIX standard defines a line as a text string with the suffix \n. Without \n, a pure text string can't be called a line. But to me, ...
2
votes
4answers
265 views

Read file line by line with awk to replace characters in certain line numbers

I have got this script here. It is supposed to run the loop by reading the file LineNumbers.file line by line (each contains a line number) and then accordingly replacing 0/0 with ./. in the ...
2
votes
6answers
653 views

sed: delete all lines before matching one, including this one

TARGET How to delete all lines in a text file before a matching one, including this one? Input file example: apple pear banana HI_THERE lemon coconut orange Desired output: lemon coconut orange ...
1
vote
1answer
136 views

sed command to replace a word from one file with entire line of another file [closed]

I want to use the sed command (or something that works) to replace a word in a template file with a word in a line of another file. As an example I have a file with a list of words, each word is in ...
1
vote
1answer
153 views

Bash script Issue parsing text in line with whitespace characters

I have a list of commands to parse through for an audit, similar to this: 1. -a *policy name=PolicyName -a *policy workflow name=PolicyWorkflow -a *policy action name=PolicyAction -s Server -b ...
0
votes
2answers
53 views

How to delete particular lines in vim editor

Suppose I have 50 lines in my vim editor and I have to delete particular lines (5,9,16,28) in a single command.
0
votes
1answer
55 views

Special content and line by line [duplicate]

commrads! I have a file: # cat file '\\.\Aktiv Co. Rutoken S 00 00\USER1@R69-20180109' '\\.\Aktiv Co. Rutoken S 00 01\USER2@R69-20180109' and i need execute line by line: for LINE in `cat file` do ...
0
votes
2answers
65 views

using $ arguments on the command line and providing values for them at the end

rather than write scripts for every single process I need to do, I like to just save commands in a text file and copy and paste them on the command line. Of course, some of the specifics of the ...
0
votes
2answers
376 views

How to make text wrap with diff -y?

When I use diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also ...
0
votes
2answers
41 views

How can I delete a particular file through the command line?

I'm using Ubuntu and would like to know if there is an easy way to delete a single file through the command line. In the same way you might use 'rmdir -r' to delete a whole file.
0
votes
2answers
172 views

grep stringset as a single line

Let say in a text file if I do grep FINAL *.msg it returns FINAL COMPUTATIONS: Elapsed Time: 000:30:55.65; CPU Time: 000:30:26.53 FINAL COMPUTATIONS: Elapsed Time: 000:28:11.77; CPU Time: ...
0
votes
0answers
8 views

How to remove a single line from zsh history?

I'm using zsh on macOS Catalina. How can I delete a specific line from zsh history without editing the zsh history file? I'm looking for an equivalent to history -d 10 on bash. The line number was ...
0
votes
0answers
13 views

The & is stripped out of a password using an append sed function [duplicate]

I have a password like this it is assigned as a variable called password2 I need to sed -i "1s/^/commit_password=$commit_password2\n/" /Downloads/sidetest11.sh I need to write this string to the ...
0
votes
1answer
25 views

Dovecot add existent folder from command line

I've insert a .INBOX.test folder in my mailbox folder /home/user/Maildir but I dont see it from Thunderbird. What i have to do for see it?! Thanks
0
votes
1answer
92 views

Running command on each line of output immediately [duplicate]

I found out that when I run a command which executes a software that has continuous output lines e.g. traffic monitor like tcpdump or tshark the command keeps counting numbers on screen like 4, 8, 12 ....
0
votes
5answers
264 views

How can I split a line that contains an underline with awk?

I have this line, but I want each part of it separated and I want this separation to be done with awk. The original line is the following: 3302491505_8139829707_13970101.csv and what I want as an ...
0
votes
1answer
247 views

fix slapcat 79 character line wrap in output

I use slapcat to do a full-text search in our very large ldap directory. As it is easier to match what I am looking for when I don't know where to look. The problem is that it wraps long lines ...
-1
votes
0answers
13 views

Escape variable within command for another variable (BASH) [duplicate]

I'm trying to store the content of a specific row and column to a variable ($value). This works with the following bash: csvpath=/home/admin/temp.csv value=$(awk 'NR==3 {print $1}' $csvpath) So far ...