LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2020, 01:06 AM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
How to count lines from result o/p?


Hello All

I want to count how many packages are there in flathub. So I issued the following command. Since I have multiple installations, It will ask which path before showing output.

Code:
$ flatpak remote-ls flathub 
Remote ‘flathub’ found in multiple installations:
1) system
2) user
Which do you want to use (0 to abort)? [0-2]:
If I give line count, I get this error
Code:
$ flatpak remote-ls flathub | wc -l
error: No remote chosen to resolve ‘flathub’ which exists in multiple installations
4
I resolved this by adding --user option
Code:
$ flatpak --user remote-ls flathub | wc -l
1658

But hypothetically, what if I didn't had --user option, and I have to give some intermediate answer, how then should I counted lines?

I hope my question is clear?

Thanks
 
Old 10-14-2020, 02:26 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I can only guess: user has a different configuration, so different remotes would be used.
 
Old 10-14-2020, 02:35 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,790

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
You can try
Code:
echo 2 | flatpak remote-ls flathub | wc -l
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
result of : top -o COMMAND ? explain the result please mike1047 Linux - Newbie 2 10-31-2019 09:20 AM
result of : top -o COMMAND ? explain the result please mike1047 Linux - Newbie 3 10-31-2019 09:18 AM
am not getting any result when am using 'if', without getting result for below script alavala53 Linux - General 3 10-25-2012 06:00 PM
[SOLVED] Grep for the result of a command within the result of another command jasonws Programming 6 11-18-2010 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration