4.Sorting: a.Create a file called days that contain the days of the week, one per line. b.Use a pipe to display a sorted list of the days to the screen. c.Repeat b) but direct the output to a file called days_sort.
i found a way to do all of them 4a)printf "Sunday\nMunday\nTuesday\nWednesday\nThursday\nFriday" >days 4b) cat days 4c) cat days >days_sort its a very simple commands to execute i have no idea how the make them in another way using pipe??
This sounds a lot like a homework exercise, so I am going to give hints here.
First up, you need to understand pipelines. I would suggest looking at the man page for bash (man bash) and searching for the word pipe (while looking at the man page, you can use the '/' character to start a search string, so you could type '/pipe' to jump to the information on pipelines (of course you could read the entire man page, and find a whole lot of other valuable information ).
Once you understand pipelines, you might want to look at the sort command. Once again, man is your friend: man sort.
You have created your file in calendar sort order. Given that, I would expect the result of the sorting in 4b to use some other sort order - alphabetical sort would be my choice.
In my opinion, using a pipe to do this is overkill given the size of your input and the fact that sort can do everything by itself. However this is all learning for bigger tasks, so I can see why they are getting you to crack the walnut with a sledgehammer. For that reason, since you have been explicitly asked to use the pipe command, I would continue to use the cat statement and pipe it through other commands.
A little more overkill - you might want to look at the more and less commands (in many modern versions of *nix environments, more and less are the same command). Once again use man to find out what they do. In step 4b) you could pipe the sorted output to either more or less. As mentioned earlier, this is overkill (especially since you only have 7 lines), but if you had more than a screen's worth of data then this would be very beneficial.