iApple Posted March 17, 2022 Share Posted March 17, 2022 (edited) Hi. Looking for a simple workflow to stripe off first line of text in clipboard, replaces string "These are the value" with "" (blank). How do I remove newline as well in 1st line? Effecting deleting entire 1st line? Tried "These are the value\n" but didn't work. Example of text in clipboard These are the value ABC DEF GHI Edited March 17, 2022 by iApple Link to comment
giovanni Posted March 17, 2022 Share Posted March 17, 2022 you could add a 'Run Script' object with this command (in bash/zsh): pbpaste | tail -n +2 | pbcopy Link to comment
iApple Posted March 17, 2022 Author Share Posted March 17, 2022 44 minutes ago, giovanni said: you could add a 'Run Script' object with this command (in bash/zsh): pbpaste | tail -n +2 | pbcopy Thanks for suggesting. Googled command line and that's display last 2 lines, but number of lines in clipboard varies all the time. Is there a way to just to delete the 1st line or pipe all lines expect first line to pbcopy? Only found "wc -l" but that looks to be cumbersome solution. Link to comment
giovanni Posted March 17, 2022 Share Posted March 17, 2022 there's a plus before 2. Tail command also comes with an ‘+’ option which is not present in the head command. With this option tail command prints the data starting from specified line number of the file instead of end. For command: tail +n file_name, data will start printing from line number ‘n’ till the end of the file specified. iApple 1 Link to comment
iApple Posted March 17, 2022 Author Share Posted March 17, 2022 2 minutes ago, giovanni said: there's a plus before 2. Tail command also comes with an ‘+’ option which is not present in the head command. With this option tail command prints the data starting from specified line number of the file instead of end. For command: tail +n file_name, data will start printing from line number ‘n’ till the end of the file specified. Thanks! Explanation helps. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now