Jump to content

Hi,

With the below code, I'm trying to echo "line" onto the same output but all i get is:

#!/bin/bash
LINE=3
( head -1 file2.log
  head -${LINE} file1.log | tail -1
  echo "line"
  tail --lines=+2 file2.log
) > file2.new

 

The echo "line" is printed under the output from file1.log which is '3'.

1
3
line
2
3
4
5
6


7
8
9
10

 

How can I echo "line" onto the same line as the output?

 

Thank you

Link to comment
https://linustechtips.com/topic/739372-bash-script-echo-on-same-line/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×